From 0b7c5367ea7f73da3c37a41248e8a307e738dbc6 Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Wed, 18 Oct 2023 01:48:39 +0100 Subject: [PATCH 1/2] fix alfajores verification --- hardhat.config.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hardhat.config.ts b/hardhat.config.ts index 7e90ef4..9bb0ab0 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -85,7 +85,7 @@ const config: HardhatUserConfig = { network: "celo", chainId: 42220, urls: { - apiURL: `https://api.celoscan.io/api`, + apiURL: "https://api.celoscan.io/api", browserURL: "https://celoscan.io/", }, }, @@ -93,7 +93,7 @@ const config: HardhatUserConfig = { network: "alfajores", chainId: 44787, urls: { - apiURL: `https://api.celoscan.io/api`, + apiURL: "https://api-alfajores.celoscan.io/api", browserURL: "https://celoscan.io/", }, }, From 99cff4387b271e160a7ff63fad275d84a9ee7b6f Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Wed, 18 Oct 2023 01:40:01 +0100 Subject: [PATCH 2/2] new deployments on all four chains --- deployments/alfajores/OffsetHelper.json | 319 +++++------------ .../75278ec65526f1e0033cc879f57dc68d.json | 125 +++++++ deployments/celo/OffsetHelper.json | 321 +++++------------ .../75278ec65526f1e0033cc879f57dc68d.json | 125 +++++++ deployments/mumbai/OffsetHelper.json | 334 +++++------------- .../75278ec65526f1e0033cc879f57dc68d.json | 125 +++++++ deployments/polygon/OffsetHelper.json | 334 +++++------------- .../75278ec65526f1e0033cc879f57dc68d.json | 125 +++++++ 8 files changed, 835 insertions(+), 973 deletions(-) create mode 100644 deployments/alfajores/solcInputs/75278ec65526f1e0033cc879f57dc68d.json create mode 100644 deployments/celo/solcInputs/75278ec65526f1e0033cc879f57dc68d.json create mode 100644 deployments/mumbai/solcInputs/75278ec65526f1e0033cc879f57dc68d.json create mode 100644 deployments/polygon/solcInputs/75278ec65526f1e0033cc879f57dc68d.json diff --git a/deployments/alfajores/OffsetHelper.json b/deployments/alfajores/OffsetHelper.json index 8d330f4..431d07c 100644 --- a/deployments/alfajores/OffsetHelper.json +++ b/deployments/alfajores/OffsetHelper.json @@ -1,5 +1,5 @@ { - "address": "0x065C0f397ecb9D904aB65242F41B9484AA9cD9Bf", + "address": "0x0CcB0071e8B8B716A2a5998aB4d97b83790873Fe", "abi": [ { "inputs": [ @@ -27,19 +27,6 @@ "stateMutability": "nonpayable", "type": "constructor" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -90,10 +77,6 @@ "name": "Redeemed", "type": "event" }, - { - "stateMutability": "payable", - "type": "fallback" - }, { "inputs": [ { @@ -322,30 +305,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "balances", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -452,24 +411,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "_erc20Addr", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "deposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [], "name": "dexRouterAddress", @@ -531,13 +472,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -786,42 +720,39 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "_erc20Addr", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "stateMutability": "payable", "type": "receive" } ], - "transactionHash": "0x7865d0ebb044ab55d08cbe6e5e069c0d4f796effb33d434252b79efdb668bd91", + "transactionHash": "0x5aa57a899d04324705100a2090339eaa57d0e8ea256605ef64f64917bdc08b5a", "receipt": { "to": null, - "from": "0x101b4C436df747B24D17ce43146Da52fa6006C36", - "contractAddress": "0x065C0f397ecb9D904aB65242F41B9484AA9cD9Bf", + "from": "0xD632d38ae05b2B760f5793b57c69246c26Bf7E8D", + "contractAddress": "0x0CcB0071e8B8B716A2a5998aB4d97b83790873Fe", "transactionIndex": 0, - "gasUsed": "4063286", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xc2eff75dd41a12b1714499985eefa8bf29d34c2176d873f20c1d1d46c96997a8", - "transactionHash": "0x7865d0ebb044ab55d08cbe6e5e069c0d4f796effb33d434252b79efdb668bd91", - "logs": [], - "blockNumber": 19828368, - "cumulativeGasUsed": "4063286", + "gasUsed": "3788520", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800200000000000000000000000000000400000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000010000000000000000000000000000000000200000000000000000000000000000000000000000000000000002020000000000000000000000000000000010000000000000000000000000000000000", + "blockHash": "0xd008a38e6ae222e4618f4650c544d60a9e7883ec566d201ae92ec5192c1143ca", + "transactionHash": "0x5aa57a899d04324705100a2090339eaa57d0e8ea256605ef64f64917bdc08b5a", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 20441210, + "transactionHash": "0x5aa57a899d04324705100a2090339eaa57d0e8ea256605ef64f64917bdc08b5a", + "address": "0x0CcB0071e8B8B716A2a5998aB4d97b83790873Fe", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000d632d38ae05b2b760f5793b57c69246c26bf7e8d" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0xd008a38e6ae222e4618f4650c544d60a9e7883ec566d201ae92ec5192c1143ca" + } + ], + "blockNumber": 20441210, + "cumulativeGasUsed": "3788520", "status": 1, "byzantium": true }, @@ -851,17 +782,17 @@ ], "0x7D28570135A2B1930F331c507F65039D4937f66c" ], - "numDeployments": 2, - "solcInputHash": "9768af37541e90e4200434e6de116099", - "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_poolAddresses\",\"type\":\"address[]\"},{\"internalType\":\"string[]\",\"name\":\"_tokenSymbolsForPaths\",\"type\":\"string[]\"},{\"internalType\":\"address[][]\",\"name\":\"_paths\",\"type\":\"address[][]\"},{\"internalType\":\"address\",\"name\":\"_dexRouterAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"poolToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"Redeemed\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_tokenSymbol\",\"type\":\"string\"},{\"internalType\":\"address[]\",\"name\":\"_path\",\"type\":\"address[]\"}],\"name\":\"addPath\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"addPoolToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"autoOffsetExactInETH\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountToSwap\",\"type\":\"uint256\"}],\"name\":\"autoOffsetExactInToken\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountToOffset\",\"type\":\"uint256\"}],\"name\":\"autoOffsetExactOutETH\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountToOffset\",\"type\":\"uint256\"}],\"name\":\"autoOffsetExactOutToken\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountToOffset\",\"type\":\"uint256\"}],\"name\":\"autoOffsetPoolToken\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"autoRedeem\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_amounts\",\"type\":\"uint256[]\"}],\"name\":\"autoRetire\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"balances\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fromTokenAmount\",\"type\":\"uint256\"}],\"name\":\"calculateExpectedPoolTokenForETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fromAmount\",\"type\":\"uint256\"}],\"name\":\"calculateExpectedPoolTokenForToken\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAmount\",\"type\":\"uint256\"}],\"name\":\"calculateNeededETHAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAmount\",\"type\":\"uint256\"}],\"name\":\"calculateNeededTokenAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_erc20Addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"dexRouterAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"eligibleSwapPaths\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"eligibleSwapPathsBySymbol\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_erc20Address\",\"type\":\"address\"}],\"name\":\"isERC20AddressEligible\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_path\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"isPoolAddressEligible\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_isEligible\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"paths\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"poolAddresses\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_tokenSymbol\",\"type\":\"string\"}],\"name\":\"removePath\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"removePoolToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"swapExactInETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fromAmount\",\"type\":\"uint256\"}],\"name\":\"swapExactInToken\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAmount\",\"type\":\"uint256\"}],\"name\":\"swapExactOutETH\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAmount\",\"type\":\"uint256\"}],\"name\":\"swapExactOutToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"tokenSymbolsForPaths\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_erc20Addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"events\":{\"Redeemed(address,address,address[],uint256[])\":{\"params\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"poolToken\":\"The address of the Toucan pool token used in the redemption, e.g., NCT\",\"sender\":\"The sender of the transaction\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}}},\"kind\":\"dev\",\"methods\":{\"addPath(string,address[])\":{\"params\":{\"_path\":\"The path of the path to add\",\"_tokenSymbol\":\"The symbol of the token to add\"}},\"addPoolToken(address)\":{\"params\":{\"_poolToken\":\"The address of the pool token to add\"}},\"autoOffsetExactInETH(address)\":{\"details\":\"This function is only available on Polygon, not on Celo.\",\"params\":{\"_poolToken\":\"The address of the pool token to offset, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoOffsetExactInToken(address,address,uint256)\":{\"details\":\"When automatically redeeming pool tokens for the lowest quality TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool token.\",\"params\":{\"_amountToSwap\":\"The amount of ERC20 token to swap into Toucan pool token. Full amount will be used for offsetting.\",\"_fromToken\":\"The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\",\"_poolToken\":\"The address of the pool token to offset, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoOffsetExactOutETH(address,uint256)\":{\"details\":\"If the user sends too much native tokens , the leftover amount will be sent back to the user. This function is only available on Polygon, not on Celo.\",\"params\":{\"_amountToOffset\":\"The amount of TCO2 to offset.\",\"_poolToken\":\"The address of the pool token to offset, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoOffsetExactOutToken(address,address,uint256)\":{\"details\":\"When automatically redeeming pool tokens for the lowest quality TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool token.\",\"params\":{\"_amountToOffset\":\"The amount of TCO2 to offset\",\"_fromToken\":\"The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\",\"_poolToken\":\"The address of the Toucan pool token that the user wants to offset, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoOffsetPoolToken(address,uint256)\":{\"params\":{\"_amountToOffset\":\"The amount of TCO2 to offset.\",\"_poolToken\":\"The address of the pool token to offset, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoRedeem(address,uint256)\":{\"details\":\"Needs to be approved on the client side\",\"params\":{\"_amount\":\"Amount to redeem\",\"_fromToken\":\"Could be the address of NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoRetire(address[],uint256[])\":{\"params\":{\"_amounts\":\"The amounts to retire from each of the corresponding TCO2 addresses\",\"_tco2s\":\"The addresses of the TCO2s to retire\"}},\"calculateExpectedPoolTokenForETH(address,uint256)\":{\"params\":{\"_fromTokenAmount\":\"The amount of native tokens to swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amountOut\":\"The expected amount of Pool token that can be acquired\"}},\"calculateExpectedPoolTokenForToken(address,address,uint256)\":{\"params\":{\"_fromAmount\":\"The amount of ERC20 token to swap\",\"_fromToken\":\"The address of the ERC20 token used for the swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amountOut\":\"The expected amount of Pool token that can be acquired\"}},\"calculateNeededETHAmount(address,uint256)\":{\"params\":{\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\",\"_toAmount\":\"The desired amount of pool token to receive\"},\"returns\":{\"amountIn\":\"The amount of native tokens required in order to swap for the specified amount of the pool token\"}},\"calculateNeededTokenAmount(address,address,uint256)\":{\"params\":{\"_fromToken\":\"The address of the ERC20 token used for the swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\",\"_toAmount\":\"The desired amount of pool token to receive\"},\"returns\":{\"amountIn\":\"The amount of the ERC20 token required in order to swap for the specified amount of the pool token\"}},\"constructor\":{\"details\":\"See `isEligible()` for a list of tokens that can be used in the contract. These can be modified after deployment by the contract owner using `setEligibleTokenAddress()` and `deleteEligibleTokenAddress()`.\",\"params\":{\"_paths\":\"An array of arrays of addresses to describe the path needed to swap form the baseToken to the pool Token to the provided token symbols.\",\"_poolAddresses\":\"A list of pool token addresses.\",\"_tokenSymbolsForPaths\":\"An array of symbols of the token the user want to retire carbon credits for\"}},\"deposit(address,uint256)\":{\"details\":\"Needs to be approved\"},\"isERC20AddressEligible(address)\":{\"params\":{\"_erc20Address\":\"The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\"},\"returns\":{\"_path\":\"Returns the path of the token to be exchanged\"}},\"isPoolAddressEligible(address)\":{\"params\":{\"_poolToken\":\"The address of the pool token to offset, e.g., NCT\"},\"returns\":{\"_isEligible\":\"Returns a bool if the Pool token is eligible for offsetting\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"removePath(string)\":{\"params\":{\"_tokenSymbol\":\"The symbol of the path to remove\"}},\"removePoolToken(address)\":{\"params\":{\"_poolToken\":\"The address of the pool token to remove\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"swapExactInETH(address)\":{\"params\":{\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amountOut\":\"Resulting amount of Toucan pool token that got acquired for the swapped native tokens .\"}},\"swapExactInToken(address,address,uint256)\":{\"details\":\"Needs to be approved on the client side.\",\"params\":{\"_fromAmount\":\"The amount of ERC20 token to swap\",\"_fromToken\":\"The address of the ERC20 token used for the swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amountOut\":\"Resulting amount of Toucan pool token that got acquired for the swapped ERC20 tokens.\"}},\"swapExactOutETH(address,uint256)\":{\"params\":{\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\",\"_toAmount\":\"The required amount of the Toucan pool token (NCT/BCT)\"}},\"swapExactOutToken(address,address,uint256)\":{\"details\":\"Needs to be approved on the client side\",\"params\":{\"_fromToken\":\"The address of the ERC20 token used for the swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\",\"_toAmount\":\"The required amount of the Toucan pool token (NCT/BCT)\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"title\":\"Toucan Protocol Offset Helpers\",\"version\":1},\"userdoc\":{\"events\":{\"Redeemed(address,address,address[],uint256[])\":{\"notice\":\"Emitted upon successful redemption of TCO2 tokens from a Toucan pool token e.g., NCT.\"}},\"kind\":\"user\",\"methods\":{\"addPath(string,address[])\":{\"notice\":\"Change or add eligible paths and their addresses.\"},\"addPoolToken(address)\":{\"notice\":\"Change or add pool token addresses.\"},\"autoOffsetExactInETH(address)\":{\"notice\":\"Retire carbon credits using the lowest quality (oldest) TCO2 tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC. All provided native tokens is consumed for offsetting. The `view` helper function `calculateExpectedPoolTokenForETH()` can be used to calculate the expected amount of TCO2s that will be offset using `autoOffsetExactInETH()`. This function: 1. Swaps the native token e.g. MATIC sent to the contract for the specified pool token. 2. Redeems the pool token for the poorest quality TCO2 tokens available. 3. Retires the TCO2 tokens.\"},\"autoOffsetExactInToken(address,address,uint256)\":{\"notice\":\"Retire carbon credits using the lowest quality (oldest) TCO2 tokens available from the specified Toucan token pool by sending ERC20 tokens (cUSD, USDC, WETH, WMATIC). All provided token is consumed for offsetting. The `view` helper function `calculateExpectedPoolTokenForToken()` can be used to calculate the expected amount of TCO2s that will be offset using `autoOffsetExactInToken()`. This function: 1. Swaps the ERC20 token sent to the contract for the specified pool token. 2. Redeems the pool token for the poorest quality TCO2 tokens available. 3. Retires the TCO2 tokens. Note: The client must approve the ERC20 token that is sent to the contract.\"},\"autoOffsetExactOutETH(address,uint256)\":{\"notice\":\"Retire carbon credits using the lowest quality (oldest) TCO2 tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC. The `view` helper function `calculateNeededETHAmount()` should be called before using `autoOffsetExactOutETH()`, to determine how much native tokens e.g., MATIC must be sent to the `OffsetHelper` contract in order to retire the specified amount of carbon. This function: 1. Swaps the native token e.g. MATIC sent to the contract for the specified pool token. 2. Redeems the pool token for the poorest quality TCO2 tokens available. 3. Retires the TCO2 tokens.\"},\"autoOffsetExactOutToken(address,address,uint256)\":{\"notice\":\"Retire carbon credits using the lowest quality (oldest) TCO2 tokens available from the specified Toucan token pool by sending ERC20 tokens (cUSD, USDC, WETH, WMATIC). The `view` helper function `calculateNeededTokenAmount()` should be called before using `autoOffsetExactOutToken()`, to determine how much native tokens e.g., MATIC must be sent to the `OffsetHelper` contract in order to retire the specified amount of carbon. This function: 1. Swaps the ERC20 token sent to the contract for the specified pool token. 2. Redeems the pool token for the poorest quality TCO2 tokens available. 3. Retires the TCO2 tokens. Note: The client must approve the ERC20 token that is sent to the contract.\"},\"autoOffsetPoolToken(address,uint256)\":{\"notice\":\"Retire carbon credits using the lowest quality (oldest) TCO2 tokens available by sending Toucan pool tokens, e.g., NCT. This function: 1. Redeems the pool token for the poorest quality TCO2 tokens available. 2. Retires the TCO2 tokens. Note: The client must approve the pool token that is sent.\"},\"autoRedeem(address,uint256)\":{\"notice\":\"Redeems the specified amount of NCT / BCT for TCO2.\"},\"autoRetire(address[],uint256[])\":{\"notice\":\"Retire the specified TCO2 tokens.\"},\"calculateExpectedPoolTokenForETH(address,uint256)\":{\"notice\":\"Calculates the expected amount of Toucan Pool token that can be acquired by swapping the provided amount of native tokens e.g., MATIC.\"},\"calculateExpectedPoolTokenForToken(address,address,uint256)\":{\"notice\":\"Calculates the expected amount of Toucan Pool token that can be acquired by swapping the provided amount of ERC20 token.\"},\"calculateNeededETHAmount(address,uint256)\":{\"notice\":\"Return how much native tokens e.g, MATIC is required in order to swap for the desired amount of a Toucan pool token, e.g., NCT.\"},\"calculateNeededTokenAmount(address,address,uint256)\":{\"notice\":\"Return how much of the specified ERC20 token is required in order to swap for the desired amount of a Toucan pool token, for example, e.g., NCT.\"},\"constructor\":{\"notice\":\"Contract constructor. Should specify arrays of ERC20 symbols and addresses that can used by the contract.\"},\"deposit(address,uint256)\":{\"notice\":\"Allow users to deposit BCT / NCT.\"},\"isERC20AddressEligible(address)\":{\"notice\":\"Checks if ERC20 Token is eligible for swapping.\"},\"isPoolAddressEligible(address)\":{\"notice\":\"Checks if Pool Address is eligible for offsetting.\"},\"removePath(string)\":{\"notice\":\"Delete eligible tokens stored in the contract.\"},\"removePoolToken(address)\":{\"notice\":\"Delete eligible pool token addresses stored in the contract.\"},\"swapExactInETH(address)\":{\"notice\":\"Swap native tokens e.g., MATIC for Toucan pool tokens (BCT/NCT) on SushiSwap. All provided native tokens will be swapped.\"},\"swapExactInToken(address,address,uint256)\":{\"notice\":\"Swap eligible ERC20 tokens for Toucan pool tokens (BCT/NCT) on SushiSwap. All provided ERC20 tokens will be swapped.\"},\"swapExactOutETH(address,uint256)\":{\"notice\":\"Swap native tokens e.g., MATIC for Toucan pool tokens (BCT/NCT) on SushiSwap. Remaining native tokens that was not consumed by the swap is returned.\"},\"swapExactOutToken(address,address,uint256)\":{\"notice\":\"Swap eligible ERC20 tokens for Toucan pool tokens (BCT/NCT) on SushiSwap\"},\"withdraw(address,uint256)\":{\"notice\":\"Allow users to withdraw tokens they have deposited.\"}},\"notice\":\"Helper functions that simplify the carbon offsetting (retirement) process. Retiring carbon tokens requires multiple steps and interactions with Toucan Protocol's main contracts: 1. Obtain a Toucan pool token e.g., NCT (by performing a token swap on a DEX). 2. Redeem the pool token for a TCO2 token. 3. Retire the TCO2 token. These steps are combined in each of the following \\\"auto offset\\\" methods implemented in `OffsetHelper` to allow a retirement within one transaction: - `autoOffsetPoolToken()` if the user already owns a Toucan pool token e.g., NCT, - `autoOffsetExactOutETH()` if the user would like to perform a retirement using native tokens e.g., MATIC, specifying the exact amount of TCO2s to retire (only on Polygon, not on Celo), - `autoOffsetExactInETH()` if the user would like to perform a retirement using native tokens, swapping all sent native tokens into TCO2s (only on Polygon, not on Celo), - `autoOffsetExactOutToken()` if the user would like to perform a retirement using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount of TCO2s to retire, - `autoOffsetExactInToken()` if the user would like to perform a retirement using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount of token to swap into TCO2s. In these methods, \\\"auto\\\" refers to the fact that these methods use `autoRedeem()` in order to automatically choose a TCO2 token corresponding to the oldest tokenized carbon project in the specfified token pool. There are no fees incurred by the user when using `autoRedeem()`, i.e., the user receives 1 TCO2 token for each pool token (BCT/NCT) redeemed. There are two `view` helper functions `calculateNeededETHAmount()` and `calculateNeededTokenAmount()` that should be called before using `autoOffsetExactOutETH()` and `autoOffsetExactOutToken()`, to determine how much native tokens e.g., MATIC, respectively how much of the ERC20 token must be sent to the `OffsetHelper` contract in order to retire the specified amount of carbon. The two `view` helper functions `calculateExpectedPoolTokenForETH()` and `calculateExpectedPoolTokenForToken()` can be used to calculate the expected amount of TCO2s that will be offset using functions `autoOffsetExactInETH()` and `autoOffsetExactInToken()`.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/OffsetHelper.sol\":\"OffsetHelper\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x247c62047745915c0af6b955470a72d1696ebad4352d7d3011aef1a2463cd888\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0xe798cadb41e2da274913e4b3183a80f50fb057a42238fe8467e077268100ec27\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20Upgradeable {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x4e733d3164f73f461eaf9d8087a7ad1ea180bdc8ba0d3d61b0e1ae16d8e63dff\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2edcb41c121abc510932e8d83ff8b82cf9cdde35e7c297622f5c29ef0af25183\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n function safePermit(\\n IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9b72f93be69ca894d8492c244259615c4a742afc8d63720dbc8bb81087d9b238\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721Receiver {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol\":{\"content\":\"pragma solidity >=0.6.2;\\n\\ninterface IUniswapV2Router01 {\\n function factory() external pure returns (address);\\n function WETH() external pure returns (address);\\n\\n function addLiquidity(\\n address tokenA,\\n address tokenB,\\n uint amountADesired,\\n uint amountBDesired,\\n uint amountAMin,\\n uint amountBMin,\\n address to,\\n uint deadline\\n ) external returns (uint amountA, uint amountB, uint liquidity);\\n function addLiquidityETH(\\n address token,\\n uint amountTokenDesired,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline\\n ) external payable returns (uint amountToken, uint amountETH, uint liquidity);\\n function removeLiquidity(\\n address tokenA,\\n address tokenB,\\n uint liquidity,\\n uint amountAMin,\\n uint amountBMin,\\n address to,\\n uint deadline\\n ) external returns (uint amountA, uint amountB);\\n function removeLiquidityETH(\\n address token,\\n uint liquidity,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline\\n ) external returns (uint amountToken, uint amountETH);\\n function removeLiquidityWithPermit(\\n address tokenA,\\n address tokenB,\\n uint liquidity,\\n uint amountAMin,\\n uint amountBMin,\\n address to,\\n uint deadline,\\n bool approveMax, uint8 v, bytes32 r, bytes32 s\\n ) external returns (uint amountA, uint amountB);\\n function removeLiquidityETHWithPermit(\\n address token,\\n uint liquidity,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline,\\n bool approveMax, uint8 v, bytes32 r, bytes32 s\\n ) external returns (uint amountToken, uint amountETH);\\n function swapExactTokensForTokens(\\n uint amountIn,\\n uint amountOutMin,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external returns (uint[] memory amounts);\\n function swapTokensForExactTokens(\\n uint amountOut,\\n uint amountInMax,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external returns (uint[] memory amounts);\\n function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)\\n external\\n payable\\n returns (uint[] memory amounts);\\n function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)\\n external\\n returns (uint[] memory amounts);\\n function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)\\n external\\n returns (uint[] memory amounts);\\n function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)\\n external\\n payable\\n returns (uint[] memory amounts);\\n\\n function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);\\n function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);\\n function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);\\n function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);\\n function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);\\n}\\n\",\"keccak256\":\"0x8a3c5c449d4b7cd76513ed6995f4b86e4a86f222c770f8442f5fc128ce29b4d2\"},\"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\":{\"content\":\"pragma solidity >=0.6.2;\\n\\nimport './IUniswapV2Router01.sol';\\n\\ninterface IUniswapV2Router02 is IUniswapV2Router01 {\\n function removeLiquidityETHSupportingFeeOnTransferTokens(\\n address token,\\n uint liquidity,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline\\n ) external returns (uint amountETH);\\n function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(\\n address token,\\n uint liquidity,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline,\\n bool approveMax, uint8 v, bytes32 r, bytes32 s\\n ) external returns (uint amountETH);\\n\\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\\n uint amountIn,\\n uint amountOutMin,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external;\\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\\n uint amountOutMin,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external payable;\\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\\n uint amountIn,\\n uint amountOutMin,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external;\\n}\\n\",\"keccak256\":\"0x744e30c133bd0f7ca9e7163433cf6d72f45c6bb1508c2c9c02f1a6db796ae59d\"},\"contracts/OffsetHelper.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2022 Toucan Labs\\n// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\\\";\\nimport \\\"./OffsetHelperStorage.sol\\\";\\nimport \\\"./interfaces/IToucanPoolToken.sol\\\";\\nimport \\\"./interfaces/IToucanCarbonOffsets.sol\\\";\\nimport \\\"./interfaces/IToucanContractRegistry.sol\\\";\\n\\n/**\\n * @title Toucan Protocol Offset Helpers\\n * @notice Helper functions that simplify the carbon offsetting (retirement)\\n * process.\\n *\\n * Retiring carbon tokens requires multiple steps and interactions with\\n * Toucan Protocol's main contracts:\\n * 1. Obtain a Toucan pool token e.g., NCT (by performing a token\\n * swap on a DEX).\\n * 2. Redeem the pool token for a TCO2 token.\\n * 3. Retire the TCO2 token.\\n *\\n * These steps are combined in each of the following \\\"auto offset\\\" methods\\n * implemented in `OffsetHelper` to allow a retirement within one transaction:\\n * - `autoOffsetPoolToken()` if the user already owns a Toucan pool\\n * token e.g., NCT,\\n * - `autoOffsetExactOutETH()` if the user would like to perform a retirement\\n * using native tokens e.g., MATIC, specifying the exact amount of TCO2s to retire (only on Polygon, not on Celo),\\n * - `autoOffsetExactInETH()` if the user would like to perform a retirement\\n * using native tokens, swapping all sent native tokens into TCO2s (only on Polygon, not on Celo),\\n * - `autoOffsetExactOutToken()` if the user would like to perform a retirement\\n * using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount\\n * of TCO2s to retire,\\n * - `autoOffsetExactInToken()` if the user would like to perform a retirement\\n * using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount\\n * of token to swap into TCO2s.\\n *\\n * In these methods, \\\"auto\\\" refers to the fact that these methods use\\n * `autoRedeem()` in order to automatically choose a TCO2 token corresponding\\n * to the oldest tokenized carbon project in the specfified token pool.\\n * There are no fees incurred by the user when using `autoRedeem()`, i.e., the\\n * user receives 1 TCO2 token for each pool token (BCT/NCT) redeemed.\\n *\\n * There are two `view` helper functions `calculateNeededETHAmount()` and\\n * `calculateNeededTokenAmount()` that should be called before using\\n * `autoOffsetExactOutETH()` and `autoOffsetExactOutToken()`, to determine how\\n * much native tokens e.g., MATIC, respectively how much of the ERC20 token must be sent to the\\n * `OffsetHelper` contract in order to retire the specified amount of carbon.\\n *\\n * The two `view` helper functions `calculateExpectedPoolTokenForETH()` and\\n * `calculateExpectedPoolTokenForToken()` can be used to calculate the\\n * expected amount of TCO2s that will be offset using functions\\n * `autoOffsetExactInETH()` and `autoOffsetExactInToken()`.\\n */\\ncontract OffsetHelper is OffsetHelperStorage {\\n using SafeERC20 for IERC20;\\n // Chain ID of Celo mainnet\\n uint256 private constant CELO_MAINNET_CHAINID = 42220;\\n\\n /**\\n * @notice Emitted upon successful redemption of TCO2 tokens from a Toucan\\n * pool token e.g., NCT.\\n *\\n * @param sender The sender of the transaction\\n * @param poolToken The address of the Toucan pool token used in the\\n * redemption, e.g., NCT\\n * @param tco2s An array of the TCO2 addresses that were redeemed\\n * @param amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n event Redeemed(\\n address sender,\\n address poolToken,\\n address[] tco2s,\\n uint256[] amounts\\n );\\n\\n modifier onlyRedeemable(address _token) {\\n require(isRedeemable(_token), \\\"Token not redeemable\\\");\\n\\n _;\\n }\\n\\n modifier onlySwappable(address _token) {\\n require(isSwappable(_token), \\\"Path doesn't yet exists.\\\");\\n\\n _;\\n }\\n\\n modifier nativeTokenChain() {\\n require(\\n block.chainid != CELO_MAINNET_CHAINID,\\n \\\"The function is not available on this network.\\\"\\n );\\n\\n _;\\n }\\n\\n /**\\n * @notice Contract constructor. Should specify arrays of ERC20 symbols and\\n * addresses that can used by the contract.\\n *\\n * @dev See `isEligible()` for a list of tokens that can be used in the\\n * contract. These can be modified after deployment by the contract owner\\n * using `setEligibleTokenAddress()` and `deleteEligibleTokenAddress()`.\\n *\\n * @param _poolAddresses A list of pool token addresses.\\n * @param _tokenSymbolsForPaths An array of symbols of the token the user want to retire carbon credits for\\n * @param _paths An array of arrays of addresses to describe the path needed to swap form the baseToken to the pool Token\\n * to the provided token symbols.\\n */\\n constructor(\\n address[] memory _poolAddresses,\\n string[] memory _tokenSymbolsForPaths,\\n address[][] memory _paths,\\n address _dexRouterAddress\\n ) {\\n dexRouterAddress = _dexRouterAddress;\\n poolAddresses = _poolAddresses;\\n tokenSymbolsForPaths = _tokenSymbolsForPaths;\\n paths = _paths;\\n\\n uint256 i = 0;\\n uint256 eligibleSwapPathsBySymbolLen = _tokenSymbolsForPaths.length;\\n while (i < eligibleSwapPathsBySymbolLen) {\\n eligibleSwapPaths[_paths[i][0]] = _paths[i];\\n eligibleSwapPathsBySymbol[_tokenSymbolsForPaths[i]] = _paths[i];\\n i += 1;\\n }\\n }\\n\\n // fallback payable and receive method to fix the situation where transfering dust native tokens\\n // in the native tokens to token swap fails\\n\\n receive() external payable {}\\n\\n fallback() external payable {}\\n\\n // ----------------------------------------\\n // Upgradable related functions\\n // ----------------------------------------\\n\\n function initialize() external virtual initializer {\\n __Ownable_init_unchained();\\n }\\n\\n // ----------------------------------------\\n // Public functions\\n // ----------------------------------------\\n\\n /**\\n * @notice Retire carbon credits using the lowest quality (oldest) TCO2\\n * tokens available from the specified Toucan token pool by sending ERC20\\n * tokens (cUSD, USDC, WETH, WMATIC). The `view` helper function\\n * `calculateNeededTokenAmount()` should be called before using `autoOffsetExactOutToken()`,\\n * to determine how much native tokens e.g., MATIC must be sent to the\\n * `OffsetHelper` contract in order to retire the specified amount of carbon.\\n *\\n * This function:\\n * 1. Swaps the ERC20 token sent to the contract for the specified pool token.\\n * 2. Redeems the pool token for the poorest quality TCO2 tokens available.\\n * 3. Retires the TCO2 tokens.\\n *\\n * Note: The client must approve the ERC20 token that is sent to the contract.\\n *\\n * @dev When automatically redeeming pool tokens for the lowest quality\\n * TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool\\n * token.\\n *\\n * @param _fromToken The address of the ERC20 token that the user sends\\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\\n * @param _poolToken The address of the Toucan pool token that the\\n * user wants to offset, e.g., NCT\\n * @param _amountToOffset The amount of TCO2 to offset\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetExactOutToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _amountToOffset\\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\\n // swap input token for BCT / NCT\\n swapExactOutToken(_fromToken, _poolToken, _amountToOffset);\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire carbon credits using the lowest quality (oldest) TCO2\\n * tokens available from the specified Toucan token pool by sending ERC20\\n * tokens (cUSD, USDC, WETH, WMATIC). All provided token is consumed for\\n * offsetting.\\n *\\n * The `view` helper function `calculateExpectedPoolTokenForToken()`\\n * can be used to calculate the expected amount of TCO2s that will be\\n * offset using `autoOffsetExactInToken()`.\\n *\\n * This function:\\n * 1. Swaps the ERC20 token sent to the contract for the specified pool token.\\n * 2. Redeems the pool token for the poorest quality TCO2 tokens available.\\n * 3. Retires the TCO2 tokens.\\n *\\n * Note: The client must approve the ERC20 token that is sent to the contract.\\n *\\n * @dev When automatically redeeming pool tokens for the lowest quality\\n * TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool\\n * token.\\n *\\n * @param _fromToken The address of the ERC20 token that the user sends\\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\\n * @param _poolToken The address of the pool token to offset,\\n * e.g., NCT\\n * @param _amountToSwap The amount of ERC20 token to swap into Toucan pool\\n * token. Full amount will be used for offsetting.\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetExactInToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _amountToSwap\\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\\n // swap input token for BCT / NCT\\n uint256 amountToOffset = swapExactInToken(\\n _fromToken,\\n _poolToken,\\n _amountToSwap\\n );\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire carbon credits using the lowest quality (oldest) TCO2\\n * tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC.\\n *\\n * The `view` helper function `calculateNeededETHAmount()` should be called before using\\n * `autoOffsetExactOutETH()`, to determine how much native tokens e.g.,\\n * MATIC must be sent to the `OffsetHelper` contract in order to retire\\n * the specified amount of carbon.\\n *\\n * This function:\\n * 1. Swaps the native token e.g. MATIC sent to the contract for the specified pool token.\\n * 2. Redeems the pool token for the poorest quality TCO2 tokens available.\\n * 3. Retires the TCO2 tokens.\\n *\\n * @dev If the user sends too much native tokens , the leftover amount will be sent back\\n * to the user. This function is only available on Polygon, not on Celo.\\n *\\n * @param _poolToken The address of the pool token to offset,\\n * e.g., NCT\\n * @param _amountToOffset The amount of TCO2 to offset.\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetExactOutETH(\\n address _poolToken,\\n uint256 _amountToOffset\\n )\\n public\\n payable\\n nativeTokenChain\\n returns (address[] memory tco2s, uint256[] memory amounts)\\n {\\n // swap native tokens for BCT / NCT\\n swapExactOutETH(_poolToken, _amountToOffset);\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire carbon credits using the lowest quality (oldest) TCO2\\n * tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC.\\n * All provided native tokens is consumed for offsetting.\\n *\\n * The `view` helper function `calculateExpectedPoolTokenForETH()` can be\\n * used to calculate the expected amount of TCO2s that will be offset\\n * using `autoOffsetExactInETH()`.\\n *\\n * This function:\\n * 1. Swaps the native token e.g. MATIC sent to the contract for the specified pool token.\\n * 2. Redeems the pool token for the poorest quality TCO2 tokens available.\\n * 3. Retires the TCO2 tokens.\\n *\\n * @dev This function is only available on Polygon, not on Celo.\\n *\\n * @param _poolToken The address of the pool token to offset,\\n * e.g., NCT\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetExactInETH(\\n address _poolToken\\n )\\n public\\n payable\\n nativeTokenChain\\n returns (address[] memory tco2s, uint256[] memory amounts)\\n {\\n // swap native tokens for BCT / NCT\\n uint256 amountToOffset = swapExactInETH(_poolToken);\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire carbon credits using the lowest quality (oldest) TCO2\\n * tokens available by sending Toucan pool tokens, e.g., NCT.\\n *\\n * This function:\\n * 1. Redeems the pool token for the poorest quality TCO2 tokens available.\\n * 2. Retires the TCO2 tokens.\\n *\\n * Note: The client must approve the pool token that is sent.\\n *\\n * @param _poolToken The address of the pool token to offset,\\n * e.g., NCT\\n * @param _amountToOffset The amount of TCO2 to offset.\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetPoolToken(\\n address _poolToken,\\n uint256 _amountToOffset\\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\\n // deposit pool token from user to this contract\\n deposit(_poolToken, _amountToOffset);\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Swap eligible ERC20 tokens for Toucan pool tokens (BCT/NCT) on SushiSwap\\n * @dev Needs to be approved on the client side\\n * @param _fromToken The address of the ERC20 token used for the swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _toAmount The required amount of the Toucan pool token (NCT/BCT)\\n */\\n function swapExactOutToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _toAmount\\n ) public onlySwappable(_fromToken) onlyRedeemable(_poolToken) {\\n // calculate path & amounts\\n (\\n address[] memory path,\\n uint256[] memory expAmounts\\n ) = calculateExactOutSwap(_fromToken, _poolToken, _toAmount);\\n uint256 amountIn = expAmounts[0];\\n\\n // transfer tokens\\n IERC20(_fromToken).safeTransferFrom(\\n msg.sender,\\n address(this),\\n amountIn\\n );\\n\\n // approve router\\n IERC20(_fromToken).approve(dexRouterAddress, amountIn);\\n\\n // swap\\n uint256[] memory amounts = dexRouter().swapTokensForExactTokens(\\n _toAmount,\\n amountIn, // max. input amount\\n path,\\n address(this),\\n block.timestamp\\n );\\n\\n // remove remaining approval if less input token was consumed\\n if (amounts[0] < amountIn) {\\n IERC20(_fromToken).approve(dexRouterAddress, 0);\\n }\\n\\n // update balances\\n balances[msg.sender][_poolToken] += _toAmount;\\n }\\n\\n /**\\n * @notice Swap eligible ERC20 tokens for Toucan pool tokens (BCT/NCT) on\\n * SushiSwap. All provided ERC20 tokens will be swapped.\\n * @dev Needs to be approved on the client side.\\n * @param _fromToken The address of the ERC20 token used for the swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _fromAmount The amount of ERC20 token to swap\\n * @return amountOut Resulting amount of Toucan pool token that got acquired for the\\n * swapped ERC20 tokens.\\n */\\n function swapExactInToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _fromAmount\\n )\\n public\\n onlySwappable(_fromToken)\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountOut)\\n {\\n // calculate path & amounts\\n\\n address[] memory path = generatePath(_fromToken, _poolToken);\\n\\n uint256 len = path.length;\\n\\n // transfer tokens\\n IERC20(_fromToken).safeTransferFrom(\\n msg.sender,\\n address(this),\\n _fromAmount\\n );\\n\\n // approve router\\n IERC20(_fromToken).safeApprove(dexRouterAddress, _fromAmount);\\n\\n // swap\\n uint256[] memory amounts = dexRouter().swapExactTokensForTokens(\\n _fromAmount,\\n 0, // min. output amount\\n path,\\n address(this),\\n block.timestamp\\n );\\n amountOut = amounts[len - 1];\\n\\n // update balances\\n balances[msg.sender][_poolToken] += amountOut;\\n }\\n\\n /**\\n * @notice Swap native tokens e.g., MATIC for Toucan pool tokens (BCT/NCT) on SushiSwap.\\n * Remaining native tokens that was not consumed by the swap is returned.\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _toAmount The required amount of the Toucan pool token (NCT/BCT)\\n */\\n function swapExactOutETH(\\n address _poolToken,\\n uint256 _toAmount\\n ) public payable nativeTokenChain onlyRedeemable(_poolToken) {\\n // create path & amounts\\n // wrap the native token\\n address fromToken = eligibleSwapPathsBySymbol[\\\"WMATIC\\\"][0];\\n address[] memory path = generatePath(fromToken, _poolToken);\\n\\n // swap\\n uint256[] memory amounts = dexRouter().swapETHForExactTokens{\\n value: msg.value\\n }(_toAmount, path, address(this), block.timestamp);\\n\\n // send surplus back\\n if (msg.value > amounts[0]) {\\n uint256 leftoverETH = msg.value - amounts[0];\\n (bool success, ) = msg.sender.call{value: leftoverETH}(\\n new bytes(0)\\n );\\n\\n require(success, \\\"Failed to send surplus back\\\");\\n }\\n\\n // update balances\\n balances[msg.sender][_poolToken] += _toAmount;\\n }\\n\\n /**\\n * @notice Swap native tokens e.g., MATIC for Toucan pool tokens (BCT/NCT) on SushiSwap. All\\n * provided native tokens will be swapped.\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @return amountOut Resulting amount of Toucan pool token that got acquired for the\\n * swapped native tokens .\\n */\\n function swapExactInETH(\\n address _poolToken\\n )\\n public\\n payable\\n nativeTokenChain\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountOut)\\n {\\n // create path & amounts\\n uint256 fromAmount = msg.value;\\n // wrap the native token\\n address fromToken = eligibleSwapPathsBySymbol[\\\"WMATIC\\\"][0];\\n address[] memory path = generatePath(fromToken, _poolToken);\\n\\n uint256 len = path.length;\\n\\n // swap\\n uint256[] memory amounts = dexRouter().swapExactETHForTokens{\\n value: fromAmount\\n }(0, path, address(this), block.timestamp);\\n amountOut = amounts[len - 1];\\n\\n // update balances\\n balances[msg.sender][_poolToken] += amountOut;\\n }\\n\\n /**\\n * @notice Allow users to withdraw tokens they have deposited.\\n */\\n function withdraw(address _erc20Addr, uint256 _amount) public {\\n require(\\n balances[msg.sender][_erc20Addr] >= _amount,\\n \\\"Insufficient balance\\\"\\n );\\n\\n IERC20(_erc20Addr).safeTransfer(msg.sender, _amount);\\n balances[msg.sender][_erc20Addr] -= _amount;\\n }\\n\\n /**\\n * @notice Allow users to deposit BCT / NCT.\\n * @dev Needs to be approved\\n */\\n function deposit(\\n address _erc20Addr,\\n uint256 _amount\\n ) public onlyRedeemable(_erc20Addr) {\\n IERC20(_erc20Addr).safeTransferFrom(msg.sender, address(this), _amount);\\n balances[msg.sender][_erc20Addr] += _amount;\\n }\\n\\n /**\\n * @notice Redeems the specified amount of NCT / BCT for TCO2.\\n * @dev Needs to be approved on the client side\\n * @param _fromToken Could be the address of NCT\\n * @param _amount Amount to redeem\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoRedeem(\\n address _fromToken,\\n uint256 _amount\\n )\\n public\\n onlyRedeemable(_fromToken)\\n returns (address[] memory tco2s, uint256[] memory amounts)\\n {\\n require(\\n balances[msg.sender][_fromToken] >= _amount,\\n \\\"Insufficient NCT/BCT balance\\\"\\n );\\n\\n // instantiate pool token (NCT)\\n IToucanPoolToken PoolTokenImplementation = IToucanPoolToken(_fromToken);\\n\\n // auto redeem pool token for TCO2; will transfer automatically picked TCO2 to this contract\\n (tco2s, amounts) = PoolTokenImplementation.redeemAuto2(_amount);\\n\\n // update balances\\n balances[msg.sender][_fromToken] -= _amount;\\n uint256 tco2sLen = tco2s.length;\\n for (uint256 index = 0; index < tco2sLen; index++) {\\n balances[msg.sender][tco2s[index]] += amounts[index];\\n }\\n\\n emit Redeemed(msg.sender, _fromToken, tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire the specified TCO2 tokens.\\n * @param _tco2s The addresses of the TCO2s to retire\\n * @param _amounts The amounts to retire from each of the corresponding\\n * TCO2 addresses\\n */\\n function autoRetire(\\n address[] memory _tco2s,\\n uint256[] memory _amounts\\n ) public {\\n uint256 tco2sLen = _tco2s.length;\\n require(tco2sLen != 0, \\\"Array empty\\\");\\n\\n require(tco2sLen == _amounts.length, \\\"Arrays unequal\\\");\\n\\n uint256 i = 0;\\n while (i < tco2sLen) {\\n if (_amounts[i] == 0) {\\n unchecked {\\n i++;\\n }\\n continue;\\n }\\n require(\\n balances[msg.sender][_tco2s[i]] >= _amounts[i],\\n \\\"Insufficient TCO2 balance\\\"\\n );\\n\\n balances[msg.sender][_tco2s[i]] -= _amounts[i];\\n\\n IToucanCarbonOffsets(_tco2s[i]).retire(_amounts[i]);\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n // ----------------------------------------\\n // Public view functions\\n // ----------------------------------------\\n\\n /**\\n * @notice Return how much of the specified ERC20 token is required in\\n * order to swap for the desired amount of a Toucan pool token, for\\n * example, e.g., NCT.\\n *\\n * @param _fromToken The address of the ERC20 token used for the swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _toAmount The desired amount of pool token to receive\\n * @return amountIn The amount of the ERC20 token required in order to\\n * swap for the specified amount of the pool token\\n */\\n function calculateNeededTokenAmount(\\n address _fromToken,\\n address _poolToken,\\n uint256 _toAmount\\n )\\n public\\n view\\n onlySwappable(_fromToken)\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountIn)\\n {\\n (, uint256[] memory amounts) = calculateExactOutSwap(\\n _fromToken,\\n _poolToken,\\n _toAmount\\n );\\n amountIn = amounts[0];\\n }\\n\\n /**\\n * @notice Calculates the expected amount of Toucan Pool token that can be\\n * acquired by swapping the provided amount of ERC20 token.\\n *\\n * @param _fromToken The address of the ERC20 token used for the swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _fromAmount The amount of ERC20 token to swap\\n * @return amountOut The expected amount of Pool token that can be acquired\\n */\\n function calculateExpectedPoolTokenForToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _fromAmount\\n )\\n public\\n view\\n onlySwappable(_fromToken)\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountOut)\\n {\\n (, uint256[] memory amounts) = calculateExactInSwap(\\n _fromToken,\\n _poolToken,\\n _fromAmount\\n );\\n amountOut = amounts[amounts.length - 1];\\n }\\n\\n /**\\n * @notice Return how much native tokens e.g, MATIC is required in order to swap for the\\n * desired amount of a Toucan pool token, e.g., NCT.\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _toAmount The desired amount of pool token to receive\\n * @return amountIn The amount of native tokens required in order to swap for\\n * the specified amount of the pool token\\n */\\n function calculateNeededETHAmount(\\n address _poolToken,\\n uint256 _toAmount\\n )\\n public\\n view\\n nativeTokenChain\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountIn)\\n {\\n address fromToken = eligibleSwapPathsBySymbol[\\\"WMATIC\\\"][0];\\n (, uint256[] memory amounts) = calculateExactOutSwap(\\n fromToken,\\n _poolToken,\\n _toAmount\\n );\\n amountIn = amounts[0];\\n }\\n\\n /**\\n * @notice Calculates the expected amount of Toucan Pool token that can be\\n * acquired by swapping the provided amount of native tokens e.g., MATIC.\\n *\\n * @param _fromTokenAmount The amount of native tokens to swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @return amountOut The expected amount of Pool token that can be acquired\\n */\\n function calculateExpectedPoolTokenForETH(\\n address _poolToken,\\n uint256 _fromTokenAmount\\n )\\n public\\n view\\n nativeTokenChain\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountOut)\\n {\\n address fromToken = eligibleSwapPathsBySymbol[\\\"WMATIC\\\"][0];\\n (, uint256[] memory amounts) = calculateExactInSwap(\\n fromToken,\\n _poolToken,\\n _fromTokenAmount\\n );\\n amountOut = amounts[amounts.length - 1];\\n }\\n\\n /**\\n * @notice Checks if Pool Address is eligible for offsetting.\\n * @param _poolToken The address of the pool token to offset,\\n * e.g., NCT\\n * @return _isEligible Returns a bool if the Pool token is eligible for offsetting\\n */\\n function isPoolAddressEligible(\\n address _poolToken\\n ) public view returns (bool _isEligible) {\\n _isEligible = isRedeemable(_poolToken);\\n }\\n\\n /**\\n * @notice Checks if ERC20 Token is eligible for swapping.\\n * @param _erc20Address The address of the ERC20 token that the user sends\\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\\n * @return _path Returns the path of the token to be exchanged\\n */\\n function isERC20AddressEligible(\\n address _erc20Address\\n ) public view returns (address[] memory _path) {\\n _path = eligibleSwapPaths[_erc20Address];\\n }\\n\\n // ----------------------------------------\\n // Internal methods\\n // ----------------------------------------\\n\\n function calculateExactOutSwap(\\n address _fromToken,\\n address _poolToken,\\n uint256 _toAmount\\n ) internal view returns (address[] memory path, uint256[] memory amounts) {\\n // create path & calculate amounts\\n path = generatePath(_fromToken, _poolToken);\\n uint256 len = path.length;\\n\\n amounts = dexRouter().getAmountsIn(_toAmount, path);\\n\\n // sanity check arrays\\n require(len == amounts.length, \\\"Arrays unequal\\\");\\n require(_toAmount == amounts[len - 1], \\\"Output amount mismatch\\\");\\n }\\n\\n function calculateExactInSwap(\\n address _fromToken,\\n address _poolToken,\\n uint256 _fromAmount\\n ) internal view returns (address[] memory path, uint256[] memory amounts) {\\n // create path & calculate amounts\\n path = generatePath(_fromToken, _poolToken);\\n uint256 len = path.length;\\n\\n amounts = dexRouter().getAmountsOut(_fromAmount, path);\\n\\n // sanity check arrays\\n require(len == amounts.length, \\\"Arrays unequal\\\");\\n require(_fromAmount == amounts[0], \\\"Input amount mismatch\\\");\\n }\\n\\n /**\\n * @notice Show all pool token addresses that can be used to retired.\\n * @param _fromToken a list of token symbols that can be retired.\\n * @param _toToken a list of token symbols that can be retired.\\n */\\n function generatePath(\\n address _fromToken,\\n address _toToken\\n ) internal view returns (address[] memory path) {\\n uint256 len = eligibleSwapPaths[_fromToken].length;\\n if (len == 1) {\\n path = new address[](2);\\n path[0] = _fromToken;\\n path[1] = _toToken;\\n return path;\\n }\\n if (len == 2) {\\n path = new address[](3);\\n path[0] = _fromToken;\\n path[1] = eligibleSwapPaths[_fromToken][1];\\n path[2] = _toToken;\\n return path;\\n }\\n if (len == 3) {\\n path = new address[](3);\\n path[0] = _fromToken;\\n path[1] = eligibleSwapPaths[_fromToken][1];\\n path[2] = eligibleSwapPaths[_fromToken][2];\\n path[3] = _toToken;\\n return path;\\n } else {\\n path = new address[](4);\\n path[0] = _fromToken;\\n path[1] = eligibleSwapPaths[_fromToken][1];\\n path[2] = eligibleSwapPaths[_fromToken][2];\\n path[3] = eligibleSwapPaths[_fromToken][3];\\n path[4] = _toToken;\\n return path;\\n }\\n }\\n\\n function dexRouter() internal view returns (IUniswapV2Router02) {\\n return IUniswapV2Router02(dexRouterAddress);\\n }\\n\\n /**\\n * @notice Checks whether an address is a Toucan pool token address\\n * @param _erc20Address address of token to be checked\\n * @return True if the address is a Toucan pool token address\\n */\\n function isRedeemable(address _erc20Address) private view returns (bool) {\\n for (uint i = 0; i < poolAddresses.length; i++) {\\n if (poolAddresses[i] == _erc20Address) {\\n return true;\\n }\\n }\\n\\n return false;\\n }\\n\\n /**\\n * @notice Checks whether an address can be used in a token swap\\n * @param _erc20Address address of token to be checked\\n * @return True if the specified address can be used in a swap\\n */\\n function isSwappable(address _erc20Address) private view returns (bool) {\\n for (uint i = 0; i < paths.length; i++) {\\n if (paths[i][0] == _erc20Address) {\\n return true;\\n }\\n }\\n\\n return false;\\n }\\n\\n /**\\n * @notice Cheks if Pool Token is eligible for Offsetting.\\n * @param _poolToken The addresses of the pool token to redeem\\n * @return _isEligible Returns if token can be redeemed\\n */\\n\\n // ----------------------------------------\\n // Admin methods\\n // ----------------------------------------\\n\\n /**\\n * @notice Change or add eligible paths and their addresses.\\n * @param _tokenSymbol The symbol of the token to add\\n * @param _path The path of the path to add\\n */\\n function addPath(\\n string memory _tokenSymbol,\\n address[] memory _path\\n ) public virtual onlyOwner {\\n eligibleSwapPaths[_path[0]] = _path;\\n eligibleSwapPathsBySymbol[_tokenSymbol] = _path;\\n tokenSymbolsForPaths.push(_tokenSymbol);\\n }\\n\\n /**\\n * @notice Delete eligible tokens stored in the contract.\\n * @param _tokenSymbol The symbol of the path to remove\\n */\\n function removePath(string memory _tokenSymbol) public virtual onlyOwner {\\n delete eligibleSwapPaths[eligibleSwapPathsBySymbol[_tokenSymbol][0]];\\n delete eligibleSwapPathsBySymbol[_tokenSymbol];\\n }\\n\\n /**\\n * @notice Change or add pool token addresses.\\n * @param _poolToken The address of the pool token to add\\n */\\n function addPoolToken(address _poolToken) public virtual onlyOwner {\\n poolAddresses.push(_poolToken);\\n }\\n\\n /**\\n * @notice Delete eligible pool token addresses stored in the contract.\\n * @param _poolToken The address of the pool token to remove\\n */\\n function removePoolToken(address _poolToken) public virtual onlyOwner {\\n for (uint256 i; i < poolAddresses.length; i++) {\\n if (poolAddresses[i] == _poolToken) {\\n poolAddresses[i] = poolAddresses[poolAddresses.length - 1];\\n poolAddresses.pop();\\n break;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x00812c8474fe0303b130513d22e4a8cf4866cb16c3a5099203ef3fd769dc1f8a\",\"license\":\"GPL-3.0\"},\"contracts/OffsetHelperStorage.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2022 Toucan Labs\\n//\\n// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\n\\ncontract OffsetHelperStorage is OwnableUpgradeable {\\n // token symbol => token address\\n mapping(address => address[]) public eligibleSwapPaths;\\n mapping(string => address[]) public eligibleSwapPathsBySymbol;\\n\\n address public dexRouterAddress;\\n\\n address[] public poolAddresses;\\n string[] public tokenSymbolsForPaths;\\n address[][] public paths;\\n\\n // user => (token => amount)\\n mapping(address => mapping(address => uint256)) public balances;\\n}\\n\",\"keccak256\":\"0xd505f00a17446ca29983779a8febff10114173db7f47ca4300d6a0bfce6b957a\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IToucanCarbonOffsets.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\\\";\\n\\nimport \\\"../types/CarbonProjectTypes.sol\\\";\\nimport \\\"../types/CarbonProjectVintageTypes.sol\\\";\\n\\ninterface IToucanCarbonOffsets is IERC20Upgradeable, IERC721Receiver {\\n function getGlobalProjectVintageIdentifiers()\\n external\\n view\\n returns (string memory, string memory);\\n\\n function getAttributes()\\n external\\n view\\n returns (ProjectData memory, VintageData memory);\\n\\n function getRemaining() external view returns (uint256 remaining);\\n\\n function getDepositCap() external view returns (uint256);\\n\\n function retire(uint256 amount) external;\\n\\n function retireFrom(address account, uint256 amount) external;\\n\\n function mintCertificateLegacy(\\n string calldata retiringEntityString,\\n address beneficiary,\\n string calldata beneficiaryString,\\n string calldata retirementMessage,\\n uint256 amount\\n ) external;\\n\\n function retireAndMintCertificate(\\n string calldata retiringEntityString,\\n address beneficiary,\\n string calldata beneficiaryString,\\n string calldata retirementMessage,\\n uint256 amount\\n ) external;\\n}\\n\",\"keccak256\":\"0x46c4ed2acd84764d0dd68c9c475e2c6ec3229a686046db48aca77ccd298d4b48\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/IToucanContractRegistry.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\npragma solidity ^0.8.0;\\n\\ninterface IToucanContractRegistry {\\n function carbonOffsetBatchesAddress() external view returns (address);\\n\\n function carbonProjectsAddress() external view returns (address);\\n\\n function carbonProjectVintagesAddress() external view returns (address);\\n\\n function toucanCarbonOffsetsFactoryAddress()\\n external\\n view\\n returns (address);\\n\\n function carbonOffsetBadgesAddress() external view returns (address);\\n\\n function checkERC20(address _address) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xa8451ff2527948e4eed26e97247b979212ccb3bd89506302b6c09ddbad392035\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/IToucanPoolToken.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\n\\ninterface IToucanPoolToken is IERC20Upgradeable {\\n function deposit(address erc20Addr, uint256 amount) external;\\n\\n function checkEligible(address erc20Addr) external view returns (bool);\\n\\n function checkAttributeMatching(address erc20Addr)\\n external\\n view\\n returns (bool);\\n\\n function calculateRedeemFees(\\n address[] memory tco2s,\\n uint256[] memory amounts\\n ) external view returns (uint256);\\n\\n function redeemMany(address[] memory tco2s, uint256[] memory amounts)\\n external;\\n\\n function redeemAuto(uint256 amount) external;\\n\\n function redeemAuto2(uint256 amount)\\n external\\n returns (address[] memory tco2s, uint256[] memory amounts);\\n\\n function getRemaining() external view returns (uint256);\\n\\n function getScoredTCO2s() external view returns (address[] memory);\\n}\\n\",\"keccak256\":\"0xef39949a81cf4ed78d789a1aac5c5860de1582be70de7435f1671931091d43a7\",\"license\":\"UNLICENSED\"},\"contracts/types/CarbonProjectTypes.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @dev CarbonProject related data and attributes\\nstruct ProjectData {\\n string projectId;\\n string standard;\\n string methodology;\\n string region;\\n string storageMethod;\\n string method;\\n string emissionType;\\n string category;\\n string uri;\\n address controller;\\n}\\n\",\"keccak256\":\"0x10d52f79d4bb8dbfe0abbb1662059d6d0193fe5794977b66aacf741451e25401\",\"license\":\"UNLICENSED\"},\"contracts/types/CarbonProjectVintageTypes.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\nstruct VintageData {\\n /// @dev A human-readable string which differentiates this from other vintages in\\n /// the same project, and helps build the corresponding TCO2 name and symbol.\\n string name;\\n uint64 startTime; // UNIX timestamp\\n uint64 endTime; // UNIX timestamp\\n uint256 projectTokenId;\\n uint64 totalVintageQuantity;\\n bool isCorsiaCompliant;\\n bool isCCPcompliant;\\n string coBenefits;\\n string correspAdjustment;\\n string additionalCertification;\\n string uri;\\n}\\n\",\"keccak256\":\"0x3a52e88a48b87f1ca3992c201f8b786ccf3aeb74796510893f8e33b33eae251b\",\"license\":\"UNLICENSED\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506040516200416338038062004163833981016040819052620000349162000585565b606780546001600160a01b0319166001600160a01b038316179055835162000064906068906020870190620001fd565b5082516200007a90606990602086019062000267565b5081516200009090606a906020850190620002c7565b5082516000905b80821015620001f157838281518110620000c157634e487b7160e01b600052603260045260246000fd5b602002602001015160656000868581518110620000ee57634e487b7160e01b600052603260045260246000fd5b60200260200101516000815181106200011757634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020908051906020019062000154929190620001fd565b508382815181106200017657634e487b7160e01b600052603260045260246000fd5b60200260200101516066868481518110620001a157634e487b7160e01b600052603260045260246000fd5b6020026020010151604051620001b89190620006fc565b90815260200160405180910390209080519060200190620001db929190620001fd565b50620001e960018362000773565b915062000097565b5050505050506200081e565b82805482825590600052602060002090810192821562000255579160200282015b828111156200025557825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906200021e565b506200026392915062000327565b5090565b828054828255906000526020600020908101928215620002b9579160200282015b82811115620002b95782518051620002a89184916020909101906200033e565b509160200191906001019062000288565b5062000263929150620003bb565b82805482825590600052602060002090810192821562000319579160200282015b8281111562000319578251805162000308918491602090910190620001fd565b5091602001919060010190620002e8565b5062000263929150620003dc565b5b8082111562000263576000815560010162000328565b8280546200034c90620007cb565b90600052602060002090601f01602090048101928262000370576000855562000255565b82601f106200038b57805160ff191683800117855562000255565b8280016001018555821562000255579182015b82811115620002555782518255916020019190600101906200039e565b8082111562000263576000620003d28282620003fd565b50600101620003bb565b8082111562000263576000620003f382826200043f565b50600101620003dc565b5080546200040b90620007cb565b6000825580601f106200041c575050565b601f0160209004906000526020600020908101906200043c919062000327565b50565b50805460008255906000526020600020908101906200043c919062000327565b80516001600160a01b03811681146200047757600080fd5b919050565b600082601f8301126200048d578081fd5b81516020620004a6620004a0836200074d565b6200071a565b80838252828201915082860187848660051b8901011115620004c6578586fd5b855b85811015620004ef57620004dc826200045f565b84529284019290840190600101620004c8565b5090979650505050505050565b600082601f8301126200050d578081fd5b8151602062000520620004a0836200074d565b80838252828201915082860187848660051b890101111562000540578586fd5b855b85811015620004ef5781516001600160401b0381111562000561578788fd5b620005718a87838c01016200047c565b855250928401929084019060010162000542565b600080600080608085870312156200059b578384fd5b84516001600160401b0380821115620005b2578586fd5b620005c0888389016200047c565b95506020870151915080821115620005d6578485fd5b818701915087601f830112620005ea578485fd5b8151620005fb620004a0826200074d565b80828252602082019150602085018b60208560051b88010111156200061e578889fd5b885b84811015620006b65781518681111562000638578a8bfd5b8701603f81018e1362000649578a8bfd5b60208101518781111562000661576200066162000808565b62000676601f8201601f19166020016200071a565b8181528f60408385010111156200068b578c8dfd5b6200069e82602083016040860162000798565b86525050602093840193919091019060010162000620565b505060408a01519097509350505080821115620006d1578384fd5b50620006e087828801620004fc565b925050620006f1606086016200045f565b905092959194509250565b600082516200071081846020870162000798565b9190910192915050565b604051601f8201601f191681016001600160401b038111828210171562000745576200074562000808565b604052919050565b60006001600160401b0382111562000769576200076962000808565b5060051b60200190565b600082198211156200079357634e487b7160e01b81526011600452602481fd5b500190565b60005b83811015620007b55781810151838201526020016200079b565b83811115620007c5576000848401525b50505050565b600181811c90821680620007e057607f821691505b602082108114156200080257634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b613935806200082e6000396000f3fe6080604052600436106101e55760003560e01c80638da5cb5b11610101578063c23f001f1161009a578063e7f67fb11161006c578063e7f67fb1146105ca578063f04ad9d7146105ea578063f2fde38b146105fd578063f3fef3a31461061d578063feb21b9c1461063d57005b8063c23f001f1461053f578063c6c53efb14610577578063d08ec47514610597578063d8a90c40146105b757005b8063a2844a86116100d3578063a2844a86146104af578063b4e76a86146104df578063b8baf9db146104ff578063c0681c3d1461051f57005b80638da5cb5b146104315780639753209d1461044f578063a09457221461046f578063a0cd60491461048f57005b80635367cd9c1161017e578063715018a611610150578063715018a6146103a757806373200b11146103bc5780638129fc1c146103dc57806382155e7e146103f15780638474c2881461041157005b80635367cd9c1461031a57806356a7de0d1461032d57806368d306d91461034d5780636d4565041461037a57005b80632e98c814116101b75780632e98c8141461029957806335bab7e5146102ba57806347e7ef24146102da5780634865b2b4146102fa57005b80631109ec99146101ee5780631357b113146102215780631661f818146102595780631a0fdecc1461027957005b366101ec57005b005b3480156101fa57600080fd5b5061020e6102093660046131f5565b61065d565b6040519081526020015b60405180910390f35b34801561022d57600080fd5b5061024161023c3660046131f5565b610753565b6040516001600160a01b039091168152602001610218565b34801561026557600080fd5b506101ec610274366004613220565b61078b565b34801561028557600080fd5b5061020e6102943660046131b5565b610a7d565b6102ac6102a73660046131f5565b610b10565b6040516102189291906135f2565b3480156102c657600080fd5b5061020e6102d53660046131b5565b610b5f565b3480156102e657600080fd5b506101ec6102f53660046131f5565b610d0a565b34801561030657600080fd5b5061020e6103153660046131b5565b610d82565b6101ec6103283660046131f5565b610e0d565b34801561033957600080fd5b506101ec61034836600461315a565b6110bd565b34801561035957600080fd5b5061036d61036836600461315a565b611209565b60405161021891906135df565b34801561038657600080fd5b5061039a6103953660046134c2565b61127f565b6040516102189190613655565b3480156103b357600080fd5b506101ec61132b565b3480156103c857600080fd5b506102416103d736600461347f565b61133f565b3480156103e857600080fd5b506101ec61136a565b3480156103fd57600080fd5b506102ac61040c3660046131f5565b61147b565b34801561041d57600080fd5b506101ec61042c3660046131b5565b6116e7565b34801561043d57600080fd5b506033546001600160a01b0316610241565b34801561045b57600080fd5b506101ec61046a3660046133f5565b6119ab565b34801561047b57600080fd5b506102ac61048a3660046131b5565b611a4c565b34801561049b57600080fd5b506102ac6104aa3660046131b5565b611a80565b3480156104bb57600080fd5b506104cf6104ca36600461315a565b611aaf565b6040519015158152602001610218565b3480156104eb57600080fd5b5061020e6104fa3660046131f5565b611ac0565b34801561050b57600080fd5b506101ec61051a366004613428565b611ba6565b34801561052b57600080fd5b506101ec61053a36600461315a565b611c8b565b34801561054b57600080fd5b5061020e61055a36600461317d565b606b60209081526000928352604080842090915290825290205481565b34801561058357600080fd5b506102416105923660046134f2565b611ce5565b3480156105a357600080fd5b506102ac6105b23660046131f5565b611d0d565b61020e6105c536600461315a565b611d1a565b3480156105d657600080fd5b50606754610241906001600160a01b031681565b6102ac6105f836600461315a565b611eec565b34801561060957600080fd5b506101ec61061836600461315a565b611f3d565b34801561062957600080fd5b506101ec6106383660046131f5565b611fb3565b34801561064957600080fd5b506102416106583660046134c2565b61206d565b600061a4ec46141561068a5760405162461bcd60e51b815260040161068190613688565b60405180910390fd5b8261069481612097565b6106b05760405162461bcd60e51b81526004016106819061370d565b600060666040516106cd9065574d4154494360d01b815260060190565b90815260200160405180910390206000815481106106fb57634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b0316915061071c82878761210f565b9150508060008151811061074057634e487b7160e01b600052603260045260246000fd5b6020026020010151935050505092915050565b6065602052816000526040600020818154811061076f57600080fd5b6000918252602090912001546001600160a01b03169150829050565b8151806107c85760405162461bcd60e51b815260206004820152600b60248201526a417272617920656d70747960a81b6044820152606401610681565b815181146107e85760405162461bcd60e51b81526004016106819061373b565b60005b81811015610a775782818151811061081357634e487b7160e01b600052603260045260246000fd5b60200260200101516000141561082b576001016107eb565b82818151811061084b57634e487b7160e01b600052603260045260246000fd5b6020026020010151606b6000336001600160a01b03166001600160a01b03168152602001908152602001600020600086848151811061089a57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000205410156109115760405162461bcd60e51b815260206004820152601960248201527f496e73756666696369656e742054434f322062616c616e6365000000000000006044820152606401610681565b82818151811061093157634e487b7160e01b600052603260045260246000fd5b6020026020010151606b6000336001600160a01b03166001600160a01b03168152602001908152602001600020600086848151811061098057634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060008282546109b79190613825565b925050819055508381815181106109de57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316633790cf57848381518110610a1457634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b8152600401610a3a91815260200190565b600060405180830381600087803b158015610a5457600080fd5b505af1158015610a68573d6000803e3d6000fd5b505050508060010190506107eb565b50505050565b600083610a898161224f565b610aa55760405162461bcd60e51b8152600401610681906136d6565b83610aaf81612097565b610acb5760405162461bcd60e51b81526004016106819061370d565b6000610ad887878761210f565b91505080600081518110610afc57634e487b7160e01b600052603260045260246000fd5b602002602001015193505050509392505050565b60608061a4ec461415610b355760405162461bcd60e51b815260040161068190613688565b610b3f8484610e0d565b610b49848461147b565b9092509050610b58828261078b565b9250929050565b600083610b6b8161224f565b610b875760405162461bcd60e51b8152600401610681906136d6565b83610b9181612097565b610bad5760405162461bcd60e51b81526004016106819061370d565b6000610bb987876122e8565b8051909150610bd36001600160a01b03891633308961289a565b606754610bed906001600160a01b038a8116911688612905565b6000610c016067546001600160a01b031690565b6001600160a01b03166338ed17398860008630426040518663ffffffff1660e01b8152600401610c3595949392919061377c565b600060405180830381600087803b158015610c4f57600080fd5b505af1158015610c63573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c8b91908101906133a2565b905080610c99600184613825565b81518110610cb757634e487b7160e01b600052603260045260246000fd5b602090810291909101810151336000908152606b835260408082206001600160a01b038d168352909352918220805491985088929091610cf890849061380d565b90915550959998505050505050505050565b81610d1481612097565b610d305760405162461bcd60e51b81526004016106819061370d565b610d456001600160a01b03841633308561289a565b336000908152606b602090815260408083206001600160a01b038716845290915281208054849290610d7890849061380d565b9091555050505050565b600083610d8e8161224f565b610daa5760405162461bcd60e51b8152600401610681906136d6565b83610db481612097565b610dd05760405162461bcd60e51b81526004016106819061370d565b6000610ddd878787612a29565b9150508060018251610def9190613825565b81518110610afc57634e487b7160e01b600052603260045260246000fd5b61a4ec461415610e2f5760405162461bcd60e51b815260040161068190613688565b81610e3981612097565b610e555760405162461bcd60e51b81526004016106819061370d565b60006066604051610e729065574d4154494360d01b815260060190565b9081526020016040518091039020600081548110610ea057634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b03169150610ec082866122e8565b90506000610ed66067546001600160a01b031690565b6001600160a01b031663fb3bdb4134878530426040518663ffffffff1660e01b8152600401610f089493929190613620565b6000604051808303818588803b158015610f2157600080fd5b505af1158015610f35573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052610f5e91908101906133a2565b905080600081518110610f8157634e487b7160e01b600052603260045260246000fd5b602002602001015134111561107d57600081600081518110610fb357634e487b7160e01b600052603260045260246000fd5b602002602001015134610fc69190613825565b604080516000808252602082019283905292935033918491610fe791613585565b60006040518083038185875af1925050503d8060008114611024576040519150601f19603f3d011682016040523d82523d6000602084013e611029565b606091505b505090508061107a5760405162461bcd60e51b815260206004820152601b60248201527f4661696c656420746f2073656e6420737572706c7573206261636b00000000006044820152606401610681565b50505b336000908152606b602090815260408083206001600160a01b038a168452909152812080548792906110b090849061380d565b9091555050505050505050565b6110c5612b5f565b60005b60685481101561120557816001600160a01b0316606882815481106110fd57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156111f3576068805461112890600190613825565b8154811061114657634e487b7160e01b600052603260045260246000fd5b600091825260209091200154606880546001600160a01b03909216918390811061118057634e487b7160e01b600052603260045260246000fd5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060688054806111cd57634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b03191690550190555050565b806111fd816138a3565b9150506110c8565b5050565b6001600160a01b03811660009081526065602090815260409182902080548351818402810184019094528084526060939283018282801561127357602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611255575b50505050509050919050565b6069818154811061128f57600080fd5b9060005260206000200160009150905080546112aa90613868565b80601f01602080910402602001604051908101604052809291908181526020018280546112d690613868565b80156113235780601f106112f857610100808354040283529160200191611323565b820191906000526020600020905b81548152906001019060200180831161130657829003601f168201915b505050505081565b611333612b5f565b61133d6000612bb9565b565b8151602081840181018051606682529282019185019190912091905280548290811061076f57600080fd5b600054610100900460ff161580801561138a5750600054600160ff909116105b806113a45750303b1580156113a4575060005460ff166001145b6114075760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610681565b6000805460ff19166001179055801561142a576000805461ff0019166101001790555b611432612c0b565b8015611478576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50565b6060808361148881612097565b6114a45760405162461bcd60e51b81526004016106819061370d565b336000908152606b602090815260408083206001600160a01b03891684529091529020548411156115175760405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e74204e43542f4243542062616c616e6365000000006044820152606401610681565b604051634c02cad160e01b81526004810185905285906001600160a01b03821690634c02cad190602401600060405180830381600087803b15801561155b57600080fd5b505af115801561156f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261159791908101906132dc565b336000908152606b602090815260408083206001600160a01b038c1684529091528120805493975091955087926115cf908490613825565b9091555050835160005b8181101561169f5784818151811061160157634e487b7160e01b600052603260045260246000fd5b6020026020010151606b6000336001600160a01b03166001600160a01b03168152602001908152602001600020600088848151811061165057634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206000828254611687919061380d565b90915550819050611697816138a3565b9150506115d9565b507f3d29f82a20ec733db9f357c4dc1ae0ee60c572cc4b877384aa4639e4d877b188338887876040516116d594939291906135a1565b60405180910390a15050509250929050565b826116f18161224f565b61170d5760405162461bcd60e51b8152600401610681906136d6565b8261171781612097565b6117335760405162461bcd60e51b81526004016106819061370d565b60008061174187878761210f565b9150915060008160008151811061176857634e487b7160e01b600052603260045260246000fd5b6020908102919091010151905061178a6001600160a01b03891633308461289a565b60675460405163095ea7b360e01b81526001600160a01b039182166004820152602481018390529089169063095ea7b390604401602060405180830381600087803b1580156117d857600080fd5b505af11580156117ec573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061181091906133d5565b5060006118256067546001600160a01b031690565b6001600160a01b0316638803dbee88848730426040518663ffffffff1660e01b815260040161185895949392919061377c565b600060405180830381600087803b15801561187257600080fd5b505af1158015611886573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526118ae91908101906133a2565b905081816000815181106118d257634e487b7160e01b600052603260045260246000fd5b602002602001015110156119685760675460405163095ea7b360e01b81526001600160a01b03918216600482015260006024820152908a169063095ea7b390604401602060405180830381600087803b15801561192e57600080fd5b505af1158015611942573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061196691906133d5565b505b336000908152606b602090815260408083206001600160a01b038c1684529091528120805489929061199b90849061380d565b9091555050505050505050505050565b6119b3612b5f565b606560006066836040516119c79190613585565b90815260200160405180910390206000815481106119f557634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528201929092526040018120611a2291612f0e565b606681604051611a329190613585565b908152602001604051809103902060006114789190612f0e565b6060806000611a5c868686610b5f565b9050611a68858261147b565b9093509150611a77838361078b565b50935093915050565b606080611a8e8585856116e7565b611a98848461147b565b9092509050611aa7828261078b565b935093915050565b6000611aba82612097565b92915050565b600061a4ec461415611ae45760405162461bcd60e51b815260040161068190613688565b82611aee81612097565b611b0a5760405162461bcd60e51b81526004016106819061370d565b60006066604051611b279065574d4154494360d01b815260060190565b9081526020016040518091039020600081548110611b5557634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b03169150611b76828787612a29565b9150508060018251611b889190613825565b8151811061074057634e487b7160e01b600052603260045260246000fd5b611bae612b5f565b806065600083600081518110611bd457634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000209080519060200190611c0f929190612f2c565b5080606683604051611c219190613585565b90815260200160405180910390209080519060200190611c42929190612f2c565b50606980546001810182556000919091528251611c86917f7fb4302e8e91f9110a6554c2c0a24601252c2a42c2220ca988efcfe39991430801906020850190612f91565b505050565b611c93612b5f565b606880546001810182556000919091527fa2153420d844928b4421650203c77babc8b33d7f2e7b450e2966db0c220977530180546001600160a01b0319166001600160a01b0392909216919091179055565b606a8281548110611cf557600080fd5b90600052602060002001818154811061076f57600080fd5b606080610b3f8484610d0a565b600061a4ec461415611d3e5760405162461bcd60e51b815260040161068190613688565b81611d4881612097565b611d645760405162461bcd60e51b81526004016106819061370d565b60405165574d4154494360d01b815234906000906066906006019081526020016040518091039020600081548110611dac57634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b03169150611dcc82876122e8565b80519091506000611de56067546001600160a01b031690565b6001600160a01b0316637ff36ab58660008630426040518663ffffffff1660e01b8152600401611e189493929190613620565b6000604051808303818588803b158015611e3157600080fd5b505af1158015611e45573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052611e6e91908101906133a2565b905080611e7c600184613825565b81518110611e9a57634e487b7160e01b600052603260045260246000fd5b602090810291909101810151336000908152606b835260408082206001600160a01b038d168352909352918220805491995089929091611edb90849061380d565b909155509698975050505050505050565b60608061a4ec461415611f115760405162461bcd60e51b815260040161068190613688565b6000611f1c84611d1a565b9050611f28848261147b565b9093509150611f37838361078b565b50915091565b611f45612b5f565b6001600160a01b038116611faa5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610681565b61147881612bb9565b336000908152606b602090815260408083206001600160a01b038616845290915290205481111561201d5760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b6044820152606401610681565b6120316001600160a01b0383163383612c7f565b336000908152606b602090815260408083206001600160a01b038616845290915281208054839290612064908490613825565b90915550505050565b6068818154811061207d57600080fd5b6000918252602090912001546001600160a01b0316905081565b6000805b60685481101561210657826001600160a01b0316606882815481106120d057634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156120f45750600192915050565b806120fe816138a3565b91505061209b565b50600092915050565b60608061211c85856122e8565b80519092506121336067546001600160a01b031690565b6001600160a01b0316631f00ca7485856040518363ffffffff1660e01b8152600401612160929190613763565b60006040518083038186803b15801561217857600080fd5b505afa15801561218c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526121b491908101906133a2565b9150815181146121d65760405162461bcd60e51b81526004016106819061373b565b816121e2600183613825565b8151811061220057634e487b7160e01b600052603260045260246000fd5b60200260200101518414611a775760405162461bcd60e51b815260206004820152601660248201527509eeae8e0eae840c2dadeeadce840dad2e6dac2e8c6d60531b6044820152606401610681565b6000805b606a5481101561210657826001600160a01b0316606a828154811061228857634e487b7160e01b600052603260045260246000fd5b906000526020600020016000815481106122b257634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156122d65750600192915050565b806122e0816138a3565b915050612253565b6001600160a01b03821660009081526065602052604090205460609060018114156123b7576040805160028082526060820183529091602083019080368337019050509150838260008151811061234f57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050828260018151811061239157634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505050611aba565b80600214156124d057604080516003808252608082019092529060208201606080368337019050509150838260008151811061240357634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600190811061244f57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260018151811061248e57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050828260028151811061239157634e487b7160e01b600052603260045260246000fd5b806003141561267457604080516003808252608082019092529060208201606080368337019050509150838260008151811061251c57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600190811061256857634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826001815181106125a757634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092018101919091529085166000908152606590915260409020805460029081106125f357634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260028151811061263257634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050828260038151811061239157634e487b7160e01b600052603260045260246000fd5b60408051600480825260a08201909252906020820160808036833701905050915083826000815181106126b757634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600190811061270357634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260018151811061274257634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600290811061278e57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826002815181106127cd57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600390811061281957634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260038151811061285857634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050828260048151811061239157634e487b7160e01b600052603260045260246000fd5b6040516001600160a01b0380851660248301528316604482015260648101829052610a779085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612caf565b80158061298e5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561295457600080fd5b505afa158015612968573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061298c91906134da565b155b6129f95760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610681565b6040516001600160a01b038316602482015260448101829052611c8690849063095ea7b360e01b906064016128ce565b606080612a3685856122e8565b8051909250612a4d6067546001600160a01b031690565b6001600160a01b031663d06ca61f85856040518363ffffffff1660e01b8152600401612a7a929190613763565b60006040518083038186803b158015612a9257600080fd5b505afa158015612aa6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612ace91908101906133a2565b915081518114612af05760405162461bcd60e51b81526004016106819061373b565b81600081518110612b1157634e487b7160e01b600052603260045260246000fd5b60200260200101518414611a775760405162461bcd60e51b8152602060048201526015602482015274092dce0eae840c2dadeeadce840dad2e6dac2e8c6d605b1b6044820152606401610681565b6033546001600160a01b0316331461133d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610681565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16612c765760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610681565b61133d33612bb9565b6040516001600160a01b038316602482015260448101829052611c8690849063a9059cbb60e01b906064016128ce565b6000612d04826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612d819092919063ffffffff16565b805190915015611c865780806020019051810190612d2291906133d5565b611c865760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610681565b6060612d908484600085612d98565b949350505050565b606082471015612df95760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610681565b600080866001600160a01b03168587604051612e159190613585565b60006040518083038185875af1925050503d8060008114612e52576040519150601f19603f3d011682016040523d82523d6000602084013e612e57565b606091505b5091509150612e6887838387612e73565b979650505050505050565b60608315612edf578251612ed8576001600160a01b0385163b612ed85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610681565b5081612d90565b612d908383815115612ef45781518083602001fd5b8060405162461bcd60e51b81526004016106819190613655565b50805460008255906000526020600020908101906114789190613005565b828054828255906000526020600020908101928215612f81579160200282015b82811115612f8157825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190612f4c565b50612f8d929150613005565b5090565b828054612f9d90613868565b90600052602060002090601f016020900481019282612fbf5760008555612f81565b82601f10612fd857805160ff1916838001178555612f81565b82800160010185558215612f81579182015b82811115612f81578251825591602001919060010190612fea565b5b80821115612f8d5760008155600101613006565b600082601f83011261302a578081fd5b8135602061303f61303a836137e9565b6137b8565b80838252828201915082860187848660051b890101111561305e578586fd5b855b85811015613085578135613073816138ea565b84529284019290840190600101613060565b5090979650505050505050565b600082601f8301126130a2578081fd5b815160206130b261303a836137e9565b80838252828201915082860187848660051b89010111156130d1578586fd5b855b85811015613085578151845292840192908401906001016130d3565b600082601f8301126130ff578081fd5b813567ffffffffffffffff811115613119576131196138d4565b61312c601f8201601f19166020016137b8565b818152846020838601011115613140578283fd5b816020850160208301379081016020019190915292915050565b60006020828403121561316b578081fd5b8135613176816138ea565b9392505050565b6000806040838503121561318f578081fd5b823561319a816138ea565b915060208301356131aa816138ea565b809150509250929050565b6000806000606084860312156131c9578081fd5b83356131d4816138ea565b925060208401356131e4816138ea565b929592945050506040919091013590565b60008060408385031215613207578182fd5b8235613212816138ea565b946020939093013593505050565b60008060408385031215613232578182fd5b823567ffffffffffffffff80821115613249578384fd5b6132558683870161301a565b935060209150818501358181111561326b578384fd5b85019050601f8101861361327d578283fd5b803561328b61303a826137e9565b80828252848201915084840189868560051b87010111156132aa578687fd5b8694505b838510156132cc5780358352600194909401939185019185016132ae565b5080955050505050509250929050565b600080604083850312156132ee578182fd5b825167ffffffffffffffff80821115613305578384fd5b818501915085601f830112613318578384fd5b8151602061332861303a836137e9565b8083825282820191508286018a848660051b8901011115613347578889fd5b8896505b8487101561337257805161335e816138ea565b83526001969096019591830191830161334b565b509188015191965090935050508082111561338b578283fd5b5061339885828601613092565b9150509250929050565b6000602082840312156133b3578081fd5b815167ffffffffffffffff8111156133c9578182fd5b612d9084828501613092565b6000602082840312156133e6578081fd5b81518015158114613176578182fd5b600060208284031215613406578081fd5b813567ffffffffffffffff81111561341c578182fd5b612d90848285016130ef565b6000806040838503121561343a578182fd5b823567ffffffffffffffff80821115613451578384fd5b61345d868387016130ef565b93506020850135915080821115613472578283fd5b506133988582860161301a565b60008060408385031215613491578182fd5b823567ffffffffffffffff8111156134a7578283fd5b6134b3858286016130ef565b95602094909401359450505050565b6000602082840312156134d3578081fd5b5035919050565b6000602082840312156134eb578081fd5b5051919050565b60008060408385031215613504578182fd5b50508035926020909101359150565b6000815180845260208085019450808401835b8381101561354b5781516001600160a01b031687529582019590820190600101613526565b509495945050505050565b6000815180845260208085019450808401835b8381101561354b57815187529582019590820190600101613569565b6000825161359781846020870161383c565b9190910192915050565b6001600160a01b038581168252841660208201526080604082018190526000906135cd90830185613513565b8281036060840152612e688185613556565b6020815260006131766020830184613513565b6040815260006136056040830185613513565b82810360208401526136178185613556565b95945050505050565b8481526080602082015260006136396080830186613513565b6001600160a01b03949094166040830152506060015292915050565b602081526000825180602084015261367481604085016020870161383c565b601f01601f19169190910160400192915050565b6020808252602e908201527f5468652066756e6374696f6e206973206e6f7420617661696c61626c65206f6e60408201526d103a3434b9903732ba3bb7b9359760911b606082015260800190565b60208082526018908201527f5061746820646f65736e277420796574206578697374732e0000000000000000604082015260600190565b602080825260149082015273546f6b656e206e6f742072656465656d61626c6560601b604082015260600190565b6020808252600e908201526d105c9c985e5cc81d5b995c5d585b60921b604082015260600190565b828152604060208201526000612d906040830184613513565b85815284602082015260a06040820152600061379b60a0830186613513565b6001600160a01b0394909416606083015250608001529392505050565b604051601f8201601f1916810167ffffffffffffffff811182821017156137e1576137e16138d4565b604052919050565b600067ffffffffffffffff821115613803576138036138d4565b5060051b60200190565b60008219821115613820576138206138be565b500190565b600082821015613837576138376138be565b500390565b60005b8381101561385757818101518382015260200161383f565b83811115610a775750506000910152565b600181811c9082168061387c57607f821691505b6020821081141561389d57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156138b7576138b76138be565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461147857600080fdfea26469706673582212200f2bb74b64168c68a4845864d66a79cf1c4ab79c19c33d5a3cd70163e4a3de7564736f6c63430008040033", - "deployedBytecode": "0x6080604052600436106101e55760003560e01c80638da5cb5b11610101578063c23f001f1161009a578063e7f67fb11161006c578063e7f67fb1146105ca578063f04ad9d7146105ea578063f2fde38b146105fd578063f3fef3a31461061d578063feb21b9c1461063d57005b8063c23f001f1461053f578063c6c53efb14610577578063d08ec47514610597578063d8a90c40146105b757005b8063a2844a86116100d3578063a2844a86146104af578063b4e76a86146104df578063b8baf9db146104ff578063c0681c3d1461051f57005b80638da5cb5b146104315780639753209d1461044f578063a09457221461046f578063a0cd60491461048f57005b80635367cd9c1161017e578063715018a611610150578063715018a6146103a757806373200b11146103bc5780638129fc1c146103dc57806382155e7e146103f15780638474c2881461041157005b80635367cd9c1461031a57806356a7de0d1461032d57806368d306d91461034d5780636d4565041461037a57005b80632e98c814116101b75780632e98c8141461029957806335bab7e5146102ba57806347e7ef24146102da5780634865b2b4146102fa57005b80631109ec99146101ee5780631357b113146102215780631661f818146102595780631a0fdecc1461027957005b366101ec57005b005b3480156101fa57600080fd5b5061020e6102093660046131f5565b61065d565b6040519081526020015b60405180910390f35b34801561022d57600080fd5b5061024161023c3660046131f5565b610753565b6040516001600160a01b039091168152602001610218565b34801561026557600080fd5b506101ec610274366004613220565b61078b565b34801561028557600080fd5b5061020e6102943660046131b5565b610a7d565b6102ac6102a73660046131f5565b610b10565b6040516102189291906135f2565b3480156102c657600080fd5b5061020e6102d53660046131b5565b610b5f565b3480156102e657600080fd5b506101ec6102f53660046131f5565b610d0a565b34801561030657600080fd5b5061020e6103153660046131b5565b610d82565b6101ec6103283660046131f5565b610e0d565b34801561033957600080fd5b506101ec61034836600461315a565b6110bd565b34801561035957600080fd5b5061036d61036836600461315a565b611209565b60405161021891906135df565b34801561038657600080fd5b5061039a6103953660046134c2565b61127f565b6040516102189190613655565b3480156103b357600080fd5b506101ec61132b565b3480156103c857600080fd5b506102416103d736600461347f565b61133f565b3480156103e857600080fd5b506101ec61136a565b3480156103fd57600080fd5b506102ac61040c3660046131f5565b61147b565b34801561041d57600080fd5b506101ec61042c3660046131b5565b6116e7565b34801561043d57600080fd5b506033546001600160a01b0316610241565b34801561045b57600080fd5b506101ec61046a3660046133f5565b6119ab565b34801561047b57600080fd5b506102ac61048a3660046131b5565b611a4c565b34801561049b57600080fd5b506102ac6104aa3660046131b5565b611a80565b3480156104bb57600080fd5b506104cf6104ca36600461315a565b611aaf565b6040519015158152602001610218565b3480156104eb57600080fd5b5061020e6104fa3660046131f5565b611ac0565b34801561050b57600080fd5b506101ec61051a366004613428565b611ba6565b34801561052b57600080fd5b506101ec61053a36600461315a565b611c8b565b34801561054b57600080fd5b5061020e61055a36600461317d565b606b60209081526000928352604080842090915290825290205481565b34801561058357600080fd5b506102416105923660046134f2565b611ce5565b3480156105a357600080fd5b506102ac6105b23660046131f5565b611d0d565b61020e6105c536600461315a565b611d1a565b3480156105d657600080fd5b50606754610241906001600160a01b031681565b6102ac6105f836600461315a565b611eec565b34801561060957600080fd5b506101ec61061836600461315a565b611f3d565b34801561062957600080fd5b506101ec6106383660046131f5565b611fb3565b34801561064957600080fd5b506102416106583660046134c2565b61206d565b600061a4ec46141561068a5760405162461bcd60e51b815260040161068190613688565b60405180910390fd5b8261069481612097565b6106b05760405162461bcd60e51b81526004016106819061370d565b600060666040516106cd9065574d4154494360d01b815260060190565b90815260200160405180910390206000815481106106fb57634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b0316915061071c82878761210f565b9150508060008151811061074057634e487b7160e01b600052603260045260246000fd5b6020026020010151935050505092915050565b6065602052816000526040600020818154811061076f57600080fd5b6000918252602090912001546001600160a01b03169150829050565b8151806107c85760405162461bcd60e51b815260206004820152600b60248201526a417272617920656d70747960a81b6044820152606401610681565b815181146107e85760405162461bcd60e51b81526004016106819061373b565b60005b81811015610a775782818151811061081357634e487b7160e01b600052603260045260246000fd5b60200260200101516000141561082b576001016107eb565b82818151811061084b57634e487b7160e01b600052603260045260246000fd5b6020026020010151606b6000336001600160a01b03166001600160a01b03168152602001908152602001600020600086848151811061089a57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000205410156109115760405162461bcd60e51b815260206004820152601960248201527f496e73756666696369656e742054434f322062616c616e6365000000000000006044820152606401610681565b82818151811061093157634e487b7160e01b600052603260045260246000fd5b6020026020010151606b6000336001600160a01b03166001600160a01b03168152602001908152602001600020600086848151811061098057634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060008282546109b79190613825565b925050819055508381815181106109de57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316633790cf57848381518110610a1457634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b8152600401610a3a91815260200190565b600060405180830381600087803b158015610a5457600080fd5b505af1158015610a68573d6000803e3d6000fd5b505050508060010190506107eb565b50505050565b600083610a898161224f565b610aa55760405162461bcd60e51b8152600401610681906136d6565b83610aaf81612097565b610acb5760405162461bcd60e51b81526004016106819061370d565b6000610ad887878761210f565b91505080600081518110610afc57634e487b7160e01b600052603260045260246000fd5b602002602001015193505050509392505050565b60608061a4ec461415610b355760405162461bcd60e51b815260040161068190613688565b610b3f8484610e0d565b610b49848461147b565b9092509050610b58828261078b565b9250929050565b600083610b6b8161224f565b610b875760405162461bcd60e51b8152600401610681906136d6565b83610b9181612097565b610bad5760405162461bcd60e51b81526004016106819061370d565b6000610bb987876122e8565b8051909150610bd36001600160a01b03891633308961289a565b606754610bed906001600160a01b038a8116911688612905565b6000610c016067546001600160a01b031690565b6001600160a01b03166338ed17398860008630426040518663ffffffff1660e01b8152600401610c3595949392919061377c565b600060405180830381600087803b158015610c4f57600080fd5b505af1158015610c63573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c8b91908101906133a2565b905080610c99600184613825565b81518110610cb757634e487b7160e01b600052603260045260246000fd5b602090810291909101810151336000908152606b835260408082206001600160a01b038d168352909352918220805491985088929091610cf890849061380d565b90915550959998505050505050505050565b81610d1481612097565b610d305760405162461bcd60e51b81526004016106819061370d565b610d456001600160a01b03841633308561289a565b336000908152606b602090815260408083206001600160a01b038716845290915281208054849290610d7890849061380d565b9091555050505050565b600083610d8e8161224f565b610daa5760405162461bcd60e51b8152600401610681906136d6565b83610db481612097565b610dd05760405162461bcd60e51b81526004016106819061370d565b6000610ddd878787612a29565b9150508060018251610def9190613825565b81518110610afc57634e487b7160e01b600052603260045260246000fd5b61a4ec461415610e2f5760405162461bcd60e51b815260040161068190613688565b81610e3981612097565b610e555760405162461bcd60e51b81526004016106819061370d565b60006066604051610e729065574d4154494360d01b815260060190565b9081526020016040518091039020600081548110610ea057634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b03169150610ec082866122e8565b90506000610ed66067546001600160a01b031690565b6001600160a01b031663fb3bdb4134878530426040518663ffffffff1660e01b8152600401610f089493929190613620565b6000604051808303818588803b158015610f2157600080fd5b505af1158015610f35573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052610f5e91908101906133a2565b905080600081518110610f8157634e487b7160e01b600052603260045260246000fd5b602002602001015134111561107d57600081600081518110610fb357634e487b7160e01b600052603260045260246000fd5b602002602001015134610fc69190613825565b604080516000808252602082019283905292935033918491610fe791613585565b60006040518083038185875af1925050503d8060008114611024576040519150601f19603f3d011682016040523d82523d6000602084013e611029565b606091505b505090508061107a5760405162461bcd60e51b815260206004820152601b60248201527f4661696c656420746f2073656e6420737572706c7573206261636b00000000006044820152606401610681565b50505b336000908152606b602090815260408083206001600160a01b038a168452909152812080548792906110b090849061380d565b9091555050505050505050565b6110c5612b5f565b60005b60685481101561120557816001600160a01b0316606882815481106110fd57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156111f3576068805461112890600190613825565b8154811061114657634e487b7160e01b600052603260045260246000fd5b600091825260209091200154606880546001600160a01b03909216918390811061118057634e487b7160e01b600052603260045260246000fd5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060688054806111cd57634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b03191690550190555050565b806111fd816138a3565b9150506110c8565b5050565b6001600160a01b03811660009081526065602090815260409182902080548351818402810184019094528084526060939283018282801561127357602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611255575b50505050509050919050565b6069818154811061128f57600080fd5b9060005260206000200160009150905080546112aa90613868565b80601f01602080910402602001604051908101604052809291908181526020018280546112d690613868565b80156113235780601f106112f857610100808354040283529160200191611323565b820191906000526020600020905b81548152906001019060200180831161130657829003601f168201915b505050505081565b611333612b5f565b61133d6000612bb9565b565b8151602081840181018051606682529282019185019190912091905280548290811061076f57600080fd5b600054610100900460ff161580801561138a5750600054600160ff909116105b806113a45750303b1580156113a4575060005460ff166001145b6114075760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610681565b6000805460ff19166001179055801561142a576000805461ff0019166101001790555b611432612c0b565b8015611478576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50565b6060808361148881612097565b6114a45760405162461bcd60e51b81526004016106819061370d565b336000908152606b602090815260408083206001600160a01b03891684529091529020548411156115175760405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e74204e43542f4243542062616c616e6365000000006044820152606401610681565b604051634c02cad160e01b81526004810185905285906001600160a01b03821690634c02cad190602401600060405180830381600087803b15801561155b57600080fd5b505af115801561156f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261159791908101906132dc565b336000908152606b602090815260408083206001600160a01b038c1684529091528120805493975091955087926115cf908490613825565b9091555050835160005b8181101561169f5784818151811061160157634e487b7160e01b600052603260045260246000fd5b6020026020010151606b6000336001600160a01b03166001600160a01b03168152602001908152602001600020600088848151811061165057634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206000828254611687919061380d565b90915550819050611697816138a3565b9150506115d9565b507f3d29f82a20ec733db9f357c4dc1ae0ee60c572cc4b877384aa4639e4d877b188338887876040516116d594939291906135a1565b60405180910390a15050509250929050565b826116f18161224f565b61170d5760405162461bcd60e51b8152600401610681906136d6565b8261171781612097565b6117335760405162461bcd60e51b81526004016106819061370d565b60008061174187878761210f565b9150915060008160008151811061176857634e487b7160e01b600052603260045260246000fd5b6020908102919091010151905061178a6001600160a01b03891633308461289a565b60675460405163095ea7b360e01b81526001600160a01b039182166004820152602481018390529089169063095ea7b390604401602060405180830381600087803b1580156117d857600080fd5b505af11580156117ec573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061181091906133d5565b5060006118256067546001600160a01b031690565b6001600160a01b0316638803dbee88848730426040518663ffffffff1660e01b815260040161185895949392919061377c565b600060405180830381600087803b15801561187257600080fd5b505af1158015611886573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526118ae91908101906133a2565b905081816000815181106118d257634e487b7160e01b600052603260045260246000fd5b602002602001015110156119685760675460405163095ea7b360e01b81526001600160a01b03918216600482015260006024820152908a169063095ea7b390604401602060405180830381600087803b15801561192e57600080fd5b505af1158015611942573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061196691906133d5565b505b336000908152606b602090815260408083206001600160a01b038c1684529091528120805489929061199b90849061380d565b9091555050505050505050505050565b6119b3612b5f565b606560006066836040516119c79190613585565b90815260200160405180910390206000815481106119f557634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528201929092526040018120611a2291612f0e565b606681604051611a329190613585565b908152602001604051809103902060006114789190612f0e565b6060806000611a5c868686610b5f565b9050611a68858261147b565b9093509150611a77838361078b565b50935093915050565b606080611a8e8585856116e7565b611a98848461147b565b9092509050611aa7828261078b565b935093915050565b6000611aba82612097565b92915050565b600061a4ec461415611ae45760405162461bcd60e51b815260040161068190613688565b82611aee81612097565b611b0a5760405162461bcd60e51b81526004016106819061370d565b60006066604051611b279065574d4154494360d01b815260060190565b9081526020016040518091039020600081548110611b5557634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b03169150611b76828787612a29565b9150508060018251611b889190613825565b8151811061074057634e487b7160e01b600052603260045260246000fd5b611bae612b5f565b806065600083600081518110611bd457634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000209080519060200190611c0f929190612f2c565b5080606683604051611c219190613585565b90815260200160405180910390209080519060200190611c42929190612f2c565b50606980546001810182556000919091528251611c86917f7fb4302e8e91f9110a6554c2c0a24601252c2a42c2220ca988efcfe39991430801906020850190612f91565b505050565b611c93612b5f565b606880546001810182556000919091527fa2153420d844928b4421650203c77babc8b33d7f2e7b450e2966db0c220977530180546001600160a01b0319166001600160a01b0392909216919091179055565b606a8281548110611cf557600080fd5b90600052602060002001818154811061076f57600080fd5b606080610b3f8484610d0a565b600061a4ec461415611d3e5760405162461bcd60e51b815260040161068190613688565b81611d4881612097565b611d645760405162461bcd60e51b81526004016106819061370d565b60405165574d4154494360d01b815234906000906066906006019081526020016040518091039020600081548110611dac57634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b03169150611dcc82876122e8565b80519091506000611de56067546001600160a01b031690565b6001600160a01b0316637ff36ab58660008630426040518663ffffffff1660e01b8152600401611e189493929190613620565b6000604051808303818588803b158015611e3157600080fd5b505af1158015611e45573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052611e6e91908101906133a2565b905080611e7c600184613825565b81518110611e9a57634e487b7160e01b600052603260045260246000fd5b602090810291909101810151336000908152606b835260408082206001600160a01b038d168352909352918220805491995089929091611edb90849061380d565b909155509698975050505050505050565b60608061a4ec461415611f115760405162461bcd60e51b815260040161068190613688565b6000611f1c84611d1a565b9050611f28848261147b565b9093509150611f37838361078b565b50915091565b611f45612b5f565b6001600160a01b038116611faa5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610681565b61147881612bb9565b336000908152606b602090815260408083206001600160a01b038616845290915290205481111561201d5760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b6044820152606401610681565b6120316001600160a01b0383163383612c7f565b336000908152606b602090815260408083206001600160a01b038616845290915281208054839290612064908490613825565b90915550505050565b6068818154811061207d57600080fd5b6000918252602090912001546001600160a01b0316905081565b6000805b60685481101561210657826001600160a01b0316606882815481106120d057634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156120f45750600192915050565b806120fe816138a3565b91505061209b565b50600092915050565b60608061211c85856122e8565b80519092506121336067546001600160a01b031690565b6001600160a01b0316631f00ca7485856040518363ffffffff1660e01b8152600401612160929190613763565b60006040518083038186803b15801561217857600080fd5b505afa15801561218c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526121b491908101906133a2565b9150815181146121d65760405162461bcd60e51b81526004016106819061373b565b816121e2600183613825565b8151811061220057634e487b7160e01b600052603260045260246000fd5b60200260200101518414611a775760405162461bcd60e51b815260206004820152601660248201527509eeae8e0eae840c2dadeeadce840dad2e6dac2e8c6d60531b6044820152606401610681565b6000805b606a5481101561210657826001600160a01b0316606a828154811061228857634e487b7160e01b600052603260045260246000fd5b906000526020600020016000815481106122b257634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156122d65750600192915050565b806122e0816138a3565b915050612253565b6001600160a01b03821660009081526065602052604090205460609060018114156123b7576040805160028082526060820183529091602083019080368337019050509150838260008151811061234f57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050828260018151811061239157634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505050611aba565b80600214156124d057604080516003808252608082019092529060208201606080368337019050509150838260008151811061240357634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600190811061244f57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260018151811061248e57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050828260028151811061239157634e487b7160e01b600052603260045260246000fd5b806003141561267457604080516003808252608082019092529060208201606080368337019050509150838260008151811061251c57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600190811061256857634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826001815181106125a757634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092018101919091529085166000908152606590915260409020805460029081106125f357634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260028151811061263257634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050828260038151811061239157634e487b7160e01b600052603260045260246000fd5b60408051600480825260a08201909252906020820160808036833701905050915083826000815181106126b757634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600190811061270357634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260018151811061274257634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600290811061278e57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826002815181106127cd57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600390811061281957634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260038151811061285857634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050828260048151811061239157634e487b7160e01b600052603260045260246000fd5b6040516001600160a01b0380851660248301528316604482015260648101829052610a779085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612caf565b80158061298e5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561295457600080fd5b505afa158015612968573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061298c91906134da565b155b6129f95760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610681565b6040516001600160a01b038316602482015260448101829052611c8690849063095ea7b360e01b906064016128ce565b606080612a3685856122e8565b8051909250612a4d6067546001600160a01b031690565b6001600160a01b031663d06ca61f85856040518363ffffffff1660e01b8152600401612a7a929190613763565b60006040518083038186803b158015612a9257600080fd5b505afa158015612aa6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612ace91908101906133a2565b915081518114612af05760405162461bcd60e51b81526004016106819061373b565b81600081518110612b1157634e487b7160e01b600052603260045260246000fd5b60200260200101518414611a775760405162461bcd60e51b8152602060048201526015602482015274092dce0eae840c2dadeeadce840dad2e6dac2e8c6d605b1b6044820152606401610681565b6033546001600160a01b0316331461133d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610681565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16612c765760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610681565b61133d33612bb9565b6040516001600160a01b038316602482015260448101829052611c8690849063a9059cbb60e01b906064016128ce565b6000612d04826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612d819092919063ffffffff16565b805190915015611c865780806020019051810190612d2291906133d5565b611c865760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610681565b6060612d908484600085612d98565b949350505050565b606082471015612df95760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610681565b600080866001600160a01b03168587604051612e159190613585565b60006040518083038185875af1925050503d8060008114612e52576040519150601f19603f3d011682016040523d82523d6000602084013e612e57565b606091505b5091509150612e6887838387612e73565b979650505050505050565b60608315612edf578251612ed8576001600160a01b0385163b612ed85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610681565b5081612d90565b612d908383815115612ef45781518083602001fd5b8060405162461bcd60e51b81526004016106819190613655565b50805460008255906000526020600020908101906114789190613005565b828054828255906000526020600020908101928215612f81579160200282015b82811115612f8157825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190612f4c565b50612f8d929150613005565b5090565b828054612f9d90613868565b90600052602060002090601f016020900481019282612fbf5760008555612f81565b82601f10612fd857805160ff1916838001178555612f81565b82800160010185558215612f81579182015b82811115612f81578251825591602001919060010190612fea565b5b80821115612f8d5760008155600101613006565b600082601f83011261302a578081fd5b8135602061303f61303a836137e9565b6137b8565b80838252828201915082860187848660051b890101111561305e578586fd5b855b85811015613085578135613073816138ea565b84529284019290840190600101613060565b5090979650505050505050565b600082601f8301126130a2578081fd5b815160206130b261303a836137e9565b80838252828201915082860187848660051b89010111156130d1578586fd5b855b85811015613085578151845292840192908401906001016130d3565b600082601f8301126130ff578081fd5b813567ffffffffffffffff811115613119576131196138d4565b61312c601f8201601f19166020016137b8565b818152846020838601011115613140578283fd5b816020850160208301379081016020019190915292915050565b60006020828403121561316b578081fd5b8135613176816138ea565b9392505050565b6000806040838503121561318f578081fd5b823561319a816138ea565b915060208301356131aa816138ea565b809150509250929050565b6000806000606084860312156131c9578081fd5b83356131d4816138ea565b925060208401356131e4816138ea565b929592945050506040919091013590565b60008060408385031215613207578182fd5b8235613212816138ea565b946020939093013593505050565b60008060408385031215613232578182fd5b823567ffffffffffffffff80821115613249578384fd5b6132558683870161301a565b935060209150818501358181111561326b578384fd5b85019050601f8101861361327d578283fd5b803561328b61303a826137e9565b80828252848201915084840189868560051b87010111156132aa578687fd5b8694505b838510156132cc5780358352600194909401939185019185016132ae565b5080955050505050509250929050565b600080604083850312156132ee578182fd5b825167ffffffffffffffff80821115613305578384fd5b818501915085601f830112613318578384fd5b8151602061332861303a836137e9565b8083825282820191508286018a848660051b8901011115613347578889fd5b8896505b8487101561337257805161335e816138ea565b83526001969096019591830191830161334b565b509188015191965090935050508082111561338b578283fd5b5061339885828601613092565b9150509250929050565b6000602082840312156133b3578081fd5b815167ffffffffffffffff8111156133c9578182fd5b612d9084828501613092565b6000602082840312156133e6578081fd5b81518015158114613176578182fd5b600060208284031215613406578081fd5b813567ffffffffffffffff81111561341c578182fd5b612d90848285016130ef565b6000806040838503121561343a578182fd5b823567ffffffffffffffff80821115613451578384fd5b61345d868387016130ef565b93506020850135915080821115613472578283fd5b506133988582860161301a565b60008060408385031215613491578182fd5b823567ffffffffffffffff8111156134a7578283fd5b6134b3858286016130ef565b95602094909401359450505050565b6000602082840312156134d3578081fd5b5035919050565b6000602082840312156134eb578081fd5b5051919050565b60008060408385031215613504578182fd5b50508035926020909101359150565b6000815180845260208085019450808401835b8381101561354b5781516001600160a01b031687529582019590820190600101613526565b509495945050505050565b6000815180845260208085019450808401835b8381101561354b57815187529582019590820190600101613569565b6000825161359781846020870161383c565b9190910192915050565b6001600160a01b038581168252841660208201526080604082018190526000906135cd90830185613513565b8281036060840152612e688185613556565b6020815260006131766020830184613513565b6040815260006136056040830185613513565b82810360208401526136178185613556565b95945050505050565b8481526080602082015260006136396080830186613513565b6001600160a01b03949094166040830152506060015292915050565b602081526000825180602084015261367481604085016020870161383c565b601f01601f19169190910160400192915050565b6020808252602e908201527f5468652066756e6374696f6e206973206e6f7420617661696c61626c65206f6e60408201526d103a3434b9903732ba3bb7b9359760911b606082015260800190565b60208082526018908201527f5061746820646f65736e277420796574206578697374732e0000000000000000604082015260600190565b602080825260149082015273546f6b656e206e6f742072656465656d61626c6560601b604082015260600190565b6020808252600e908201526d105c9c985e5cc81d5b995c5d585b60921b604082015260600190565b828152604060208201526000612d906040830184613513565b85815284602082015260a06040820152600061379b60a0830186613513565b6001600160a01b0394909416606083015250608001529392505050565b604051601f8201601f1916810167ffffffffffffffff811182821017156137e1576137e16138d4565b604052919050565b600067ffffffffffffffff821115613803576138036138d4565b5060051b60200190565b60008219821115613820576138206138be565b500190565b600082821015613837576138376138be565b500390565b60005b8381101561385757818101518382015260200161383f565b83811115610a775750506000910152565b600181811c9082168061387c57607f821691505b6020821081141561389d57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156138b7576138b76138be565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461147857600080fdfea26469706673582212200f2bb74b64168c68a4845864d66a79cf1c4ab79c19c33d5a3cd70163e4a3de7564736f6c63430008040033", + "numDeployments": 3, + "solcInputHash": "75278ec65526f1e0033cc879f57dc68d", + "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_poolAddresses\",\"type\":\"address[]\"},{\"internalType\":\"string[]\",\"name\":\"_tokenSymbolsForPaths\",\"type\":\"string[]\"},{\"internalType\":\"address[][]\",\"name\":\"_paths\",\"type\":\"address[][]\"},{\"internalType\":\"address\",\"name\":\"_dexRouterAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"poolToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"Redeemed\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_tokenSymbol\",\"type\":\"string\"},{\"internalType\":\"address[]\",\"name\":\"_path\",\"type\":\"address[]\"}],\"name\":\"addPath\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"addPoolToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"autoOffsetExactInETH\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountToSwap\",\"type\":\"uint256\"}],\"name\":\"autoOffsetExactInToken\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountToOffset\",\"type\":\"uint256\"}],\"name\":\"autoOffsetExactOutETH\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountToOffset\",\"type\":\"uint256\"}],\"name\":\"autoOffsetExactOutToken\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountToOffset\",\"type\":\"uint256\"}],\"name\":\"autoOffsetPoolToken\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"autoRedeem\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_amounts\",\"type\":\"uint256[]\"}],\"name\":\"autoRetire\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fromTokenAmount\",\"type\":\"uint256\"}],\"name\":\"calculateExpectedPoolTokenForETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fromAmount\",\"type\":\"uint256\"}],\"name\":\"calculateExpectedPoolTokenForToken\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAmount\",\"type\":\"uint256\"}],\"name\":\"calculateNeededETHAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAmount\",\"type\":\"uint256\"}],\"name\":\"calculateNeededTokenAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"dexRouterAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"eligibleSwapPaths\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"eligibleSwapPathsBySymbol\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_erc20Address\",\"type\":\"address\"}],\"name\":\"isERC20AddressEligible\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_path\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"isPoolAddressEligible\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_isEligible\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"paths\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"poolAddresses\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_tokenSymbol\",\"type\":\"string\"}],\"name\":\"removePath\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"removePoolToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"swapExactInETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fromAmount\",\"type\":\"uint256\"}],\"name\":\"swapExactInToken\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAmount\",\"type\":\"uint256\"}],\"name\":\"swapExactOutETH\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAmount\",\"type\":\"uint256\"}],\"name\":\"swapExactOutToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"tokenSymbolsForPaths\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"events\":{\"Redeemed(address,address,address[],uint256[])\":{\"params\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"poolToken\":\"The address of the pool token used in the redemption, e.g., NCT\",\"sender\":\"The sender of the transaction\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}}},\"kind\":\"dev\",\"methods\":{\"addPath(string,address[])\":{\"params\":{\"_path\":\"The path of the path to add\",\"_tokenSymbol\":\"The symbol of the token to add\"}},\"addPoolToken(address)\":{\"params\":{\"_poolToken\":\"The address of the pool token to add\"}},\"autoOffsetExactInETH(address)\":{\"details\":\"This function is only available on Polygon, not on Celo.\",\"params\":{\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoOffsetExactInToken(address,address,uint256)\":{\"details\":\"When automatically redeeming pool tokens for the oldest ones TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool token.\",\"params\":{\"_amountToSwap\":\"The amount of ERC20 token to swap into Toucan pool token. Full amount will be used for offsetting.\",\"_fromToken\":\"The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\",\"_poolToken\":\"The address of the pool token that the user wants to use, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoOffsetExactOutETH(address,uint256)\":{\"details\":\"If the user sends too much native tokens , the leftover amount will be sent back to the user. This function is only available on Polygon, not on Celo.\",\"params\":{\"_amountToOffset\":\"The amount of TCO2 to offset.\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoOffsetExactOutToken(address,address,uint256)\":{\"details\":\"When automatically redeeming pool tokens for the oldest ones TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool token.\",\"params\":{\"_amountToOffset\":\"The amount of TCO2 to offset\",\"_fromToken\":\"The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\",\"_poolToken\":\"The address of the pool token that the user wants to use, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoOffsetPoolToken(address,uint256)\":{\"params\":{\"_amountToOffset\":\"The amount of TCO2 to offset.\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoRedeem(address,uint256)\":{\"details\":\"Needs to be approved on the client side\",\"params\":{\"_amount\":\"Amount to redeem\",\"_fromToken\":\"Could be the address of NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoRetire(address[],uint256[])\":{\"params\":{\"_amounts\":\"The amounts to retire from each of the corresponding TCO2 addresses\",\"_tco2s\":\"The addresses of the TCO2s to retire\"}},\"calculateExpectedPoolTokenForETH(address,uint256)\":{\"params\":{\"_fromTokenAmount\":\"The amount of native tokens to swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amountOut\":\"The expected amount of Pool token that can be acquired\"}},\"calculateExpectedPoolTokenForToken(address,address,uint256)\":{\"params\":{\"_fromAmount\":\"The amount of ERC20 token to swap\",\"_fromToken\":\"The address of the ERC20 token used for the swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amountOut\":\"The expected amount of Pool token that can be acquired\"}},\"calculateNeededETHAmount(address,uint256)\":{\"params\":{\"_poolToken\":\"The address of the pool token to swap for, for example, NCT\",\"_toAmount\":\"The desired amount of pool token to receive\"},\"returns\":{\"amountIn\":\"The amount of native tokens required in order to swap for the specified amount of the pool token\"}},\"calculateNeededTokenAmount(address,address,uint256)\":{\"params\":{\"_fromToken\":\"The address of the ERC20 token used for the swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\",\"_toAmount\":\"The desired amount of pool token to receive\"},\"returns\":{\"amountIn\":\"The amount of the ERC20 token required in order to swap for the specified amount of the pool token\"}},\"constructor\":{\"details\":\"See `isEligible()` for a list of tokens that can be used in the contract. These can be modified after deployment by the contract owner using `setEligibleTokenAddress()` and `deleteEligibleTokenAddress()`.\",\"params\":{\"_paths\":\"An array of arrays of addresses to describe the path needed to swap form the baseToken to the pool Token to the provided token symbols.\",\"_poolAddresses\":\"A list of pool token addresses.\",\"_tokenSymbolsForPaths\":\"An array of symbols of the token the user want to retire carbon credits for\"}},\"isERC20AddressEligible(address)\":{\"params\":{\"_erc20Address\":\"The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\"},\"returns\":{\"_path\":\"Returns the path of the token to be exchanged\"}},\"isPoolAddressEligible(address)\":{\"params\":{\"_poolToken\":\"The addresses of the pool token to redeem\"},\"returns\":{\"_isEligible\":\"Returns if token can be redeemed\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"removePath(string)\":{\"params\":{\"_tokenSymbol\":\"The symbol of the path to remove\"}},\"removePoolToken(address)\":{\"params\":{\"_poolToken\":\"The address of the pool token to remove\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"swapExactInETH(address)\":{\"params\":{\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amountOut\":\"Resulting amount of pool token that got acquired for the swapped native tokens .\"}},\"swapExactInToken(address,address,uint256)\":{\"details\":\"Needs to be approved on the client side.\",\"params\":{\"_fromAmount\":\"The amount of ERC20 token to swap e.g., NCT\",\"_fromToken\":\"The address of the ERC20 token used for the swap\",\"_poolToken\":\"The address of the pool token to swap for,\"},\"returns\":{\"amountOut\":\"Resulting amount of pool token that got acquired for the swapped ERC20 tokens.\"}},\"swapExactOutETH(address,uint256)\":{\"params\":{\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\",\"_toAmount\":\"The required amount of the pool token (NCT/BCT)\"}},\"swapExactOutToken(address,address,uint256)\":{\"details\":\"Needs to be approved on the client side\",\"params\":{\"_fromToken\":\"The address of the ERC20 token used for the swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\",\"_toAmount\":\"The required amount of the pool token (NCT/BCT)\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"title\":\"Toucan Protocol Offset Helpers\",\"version\":1},\"userdoc\":{\"events\":{\"Redeemed(address,address,address[],uint256[])\":{\"notice\":\"Emitted upon successful redemption of TCO2 tokens from a Toucan pool token e.g., NCT.\"}},\"kind\":\"user\",\"methods\":{\"addPath(string,address[])\":{\"notice\":\"Change or add eligible paths and their addresses.\"},\"addPoolToken(address)\":{\"notice\":\"Change or add pool token addresses.\"},\"autoOffsetExactInETH(address)\":{\"notice\":\"Retire carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC. All provided native tokens is consumed for offsetting. Use `calculateExpectedPoolTokenForETH()` to calculate the expected amount of Pool token that can be acquired by swapping the provided amount of native tokens e.g., MATIC. This function: 1. Swaps the Matic sent to the contract for the specified pool token. 2. Redeems the pool token for the oldest TCO2 tokens available. 3. Retires the TCO2 tokens.\"},\"autoOffsetExactInToken(address,address,uint256)\":{\"notice\":\"Retire carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending ERC20 tokens (cUSD, USDC, WETH, WMATIC). All provided token is consumed for offsetting. Use `calculateExpectedPoolTokenForToken()` to calculate the expected amount of Pool token that can be acquired by swapping the provided amount of ERC20 token. This function: 1. Swaps the ERC20 token sent to the contract for the specified pool token. 2. Redeems the pool token for the oldest TCO2 tokens available. 3. Retires the TCO2 tokens. Note: The client must approve the ERC20 token that is sent to the contract.\"},\"autoOffsetExactOutETH(address,uint256)\":{\"notice\":\"Retire carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC. Use `calculateNeededETHAmount()` first in order to find out how much native tokens are required to retire the specified quantity of TCO2. This function: 1. Swaps the Matic sent to the contract for the specified pool token. 2. Redeems the pool token for the oldest TCO2 tokens available. 3. Retires the TCO2 tokens.\"},\"autoOffsetExactOutToken(address,address,uint256)\":{\"notice\":\"Retire carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending ERC20 tokens (cUSD, USDC, WETH, WMATIC). Use `calculateNeededTokenAmount` first in order to find out how much of the ERC20 token is required to retire the specified quantity of TCO2. This function: 1. Swaps the ERC20 token sent to the contract for the specified pool token. 2. Redeems the pool token for the oldest TCO2 tokens available. 3. Retires the TCO2 tokens. Note: The client must approve the ERC20 token that is sent to the contract.\"},\"autoOffsetPoolToken(address,uint256)\":{\"notice\":\"Retire carbon credits using the oldest TCO2 tokens available by sending pool tokens, e.g., NCT. This function: 1. Redeems the pool token for the oldest TCO2 tokens available. 2. Retires the TCO2 tokens. Note: The client must approve the pool token that is sent.\"},\"autoRedeem(address,uint256)\":{\"notice\":\"Redeems the specified amount of NCT / BCT for TCO2.\"},\"autoRetire(address[],uint256[])\":{\"notice\":\"Retire the specified TCO2 tokens.\"},\"calculateExpectedPoolTokenForETH(address,uint256)\":{\"notice\":\"Calculates the expected amount of pool token that can be acquired by swapping the provided amount of native tokens e.g., MATIC.\"},\"calculateExpectedPoolTokenForToken(address,address,uint256)\":{\"notice\":\"Calculates the expected amount of pool token that can be acquired by swapping the provided amount of ERC20 token.\"},\"calculateNeededETHAmount(address,uint256)\":{\"notice\":\"Return how much native tokens e.g, MATIC is required in order to swap for the desired amount of a pool token, e.g., NCT.\"},\"calculateNeededTokenAmount(address,address,uint256)\":{\"notice\":\"Return how much of the specified ERC20 token is required in order to swap for the desired amount of a pool token, for example, e.g., NCT.\"},\"constructor\":{\"notice\":\"Contract constructor. Should specify arrays of ERC20 symbols and addresses that can used by the contract.\"},\"isERC20AddressEligible(address)\":{\"notice\":\"Checks if ERC20 Token is eligible for Offsetting.\"},\"isPoolAddressEligible(address)\":{\"notice\":\"Cheks if Pool Token is eligible for Offsetting.\"},\"removePath(string)\":{\"notice\":\"Delete eligible tokens stored in the contract.\"},\"removePoolToken(address)\":{\"notice\":\"Delete eligible pool token addresses stored in the contract.\"},\"swapExactInETH(address)\":{\"notice\":\"Swap native tokens e.g., MATIC for pool tokens (BCT/NCT) on SushiSwap. All provided native tokens will be swapped.\"},\"swapExactInToken(address,address,uint256)\":{\"notice\":\"Swap eligible ERC20 tokens for pool tokens (BCT/NCT) on SushiSwap. All provided ERC20 tokens will be swapped.\"},\"swapExactOutETH(address,uint256)\":{\"notice\":\"Swap native tokens e.g., MATIC for pool tokens (BCT/NCT) on SushiSwap. Remaining native tokens that was not consumed by the swap is returned.\"},\"swapExactOutToken(address,address,uint256)\":{\"notice\":\"Swap eligible ERC20 tokens for pool tokens (BCT/NCT) on SushiSwap\"}},\"notice\":\"Helper functions that simplify the carbon offsetting (retirement) process. Retiring carbon tokens requires multiple steps and interactions with Toucan Protocol's main contracts: 1. Obtain a pool token e.g., NCT (by performing a token swap on a DEX). 2. Redeem the pool token for a TCO2 token. 3. Retire the TCO2 token. These steps are combined in each of the following \\\"auto offset\\\" methods implemented in `OffsetHelper` to allow a retirement within one transaction: - `autoOffsetPoolToken()` if the user already owns a Toucan pool token e.g., NCT, - `autoOffsetExactOutETH()` if the user would like to perform a retirement using native tokens e.g., MATIC, specifying the exact amount of TCO2s to retire (only on Polygon, not on Celo), - `autoOffsetExactInETH()` if the user would like to perform a retirement using native tokens, swapping all sent native tokens into TCO2s (only on Polygon, not on Celo), - `autoOffsetExactOutToken()` if the user would like to perform a retirement using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount of TCO2s to retire, - `autoOffsetExactInToken()` if the user would like to perform a retirement using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount of token to swap into TCO2s. In these methods, \\\"auto\\\" refers to the fact that these methods use `autoRedeem()` in order to automatically choose a TCO2 token corresponding to the oldest tokenized carbon project in the specfified token pool. There are no fees incurred by the user when using `autoRedeem()`, i.e., the user receives 1 TCO2 token for each pool token (BCT/NCT) redeemed. There are two `view` helper functions `calculateNeededETHAmount()` and `calculateNeededTokenAmount()` that should be called before using `autoOffsetExactOutETH()` and `autoOffsetExactOutToken()`, to determine how much native tokens e.g., MATIC, respectively how much of the ERC20 token must be sent to the `OffsetHelper` contract in order to retire the specified amount of carbon. The two `view` helper functions `calculateExpectedPoolTokenForETH()` and `calculateExpectedPoolTokenForToken()` can be used to calculate the expected amount of TCO2s that will be offset using functions `autoOffsetExactInETH()` and `autoOffsetExactInToken()`.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/OffsetHelper.sol\":\"OffsetHelper\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20Upgradeable {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x4e733d3164f73f461eaf9d8087a7ad1ea180bdc8ba0d3d61b0e1ae16d8e63dff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n function safePermit(\\n IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9b72f93be69ca894d8492c244259615c4a742afc8d63720dbc8bb81087d9b238\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721Receiver {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol\":{\"content\":\"pragma solidity >=0.6.2;\\n\\ninterface IUniswapV2Router01 {\\n function factory() external pure returns (address);\\n function WETH() external pure returns (address);\\n\\n function addLiquidity(\\n address tokenA,\\n address tokenB,\\n uint amountADesired,\\n uint amountBDesired,\\n uint amountAMin,\\n uint amountBMin,\\n address to,\\n uint deadline\\n ) external returns (uint amountA, uint amountB, uint liquidity);\\n function addLiquidityETH(\\n address token,\\n uint amountTokenDesired,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline\\n ) external payable returns (uint amountToken, uint amountETH, uint liquidity);\\n function removeLiquidity(\\n address tokenA,\\n address tokenB,\\n uint liquidity,\\n uint amountAMin,\\n uint amountBMin,\\n address to,\\n uint deadline\\n ) external returns (uint amountA, uint amountB);\\n function removeLiquidityETH(\\n address token,\\n uint liquidity,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline\\n ) external returns (uint amountToken, uint amountETH);\\n function removeLiquidityWithPermit(\\n address tokenA,\\n address tokenB,\\n uint liquidity,\\n uint amountAMin,\\n uint amountBMin,\\n address to,\\n uint deadline,\\n bool approveMax, uint8 v, bytes32 r, bytes32 s\\n ) external returns (uint amountA, uint amountB);\\n function removeLiquidityETHWithPermit(\\n address token,\\n uint liquidity,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline,\\n bool approveMax, uint8 v, bytes32 r, bytes32 s\\n ) external returns (uint amountToken, uint amountETH);\\n function swapExactTokensForTokens(\\n uint amountIn,\\n uint amountOutMin,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external returns (uint[] memory amounts);\\n function swapTokensForExactTokens(\\n uint amountOut,\\n uint amountInMax,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external returns (uint[] memory amounts);\\n function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)\\n external\\n payable\\n returns (uint[] memory amounts);\\n function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)\\n external\\n returns (uint[] memory amounts);\\n function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)\\n external\\n returns (uint[] memory amounts);\\n function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)\\n external\\n payable\\n returns (uint[] memory amounts);\\n\\n function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);\\n function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);\\n function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);\\n function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);\\n function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);\\n}\\n\",\"keccak256\":\"0x8a3c5c449d4b7cd76513ed6995f4b86e4a86f222c770f8442f5fc128ce29b4d2\"},\"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\":{\"content\":\"pragma solidity >=0.6.2;\\n\\nimport './IUniswapV2Router01.sol';\\n\\ninterface IUniswapV2Router02 is IUniswapV2Router01 {\\n function removeLiquidityETHSupportingFeeOnTransferTokens(\\n address token,\\n uint liquidity,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline\\n ) external returns (uint amountETH);\\n function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(\\n address token,\\n uint liquidity,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline,\\n bool approveMax, uint8 v, bytes32 r, bytes32 s\\n ) external returns (uint amountETH);\\n\\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\\n uint amountIn,\\n uint amountOutMin,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external;\\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\\n uint amountOutMin,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external payable;\\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\\n uint amountIn,\\n uint amountOutMin,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external;\\n}\\n\",\"keccak256\":\"0x744e30c133bd0f7ca9e7163433cf6d72f45c6bb1508c2c9c02f1a6db796ae59d\"},\"contracts/OffsetHelper.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2022 Toucan Labs\\n// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\\\";\\nimport \\\"./OffsetHelperStorage.sol\\\";\\nimport \\\"./interfaces/IToucanPoolToken.sol\\\";\\nimport \\\"./interfaces/IToucanCarbonOffsets.sol\\\";\\nimport \\\"./interfaces/IToucanContractRegistry.sol\\\";\\n\\n/**\\n * @title Toucan Protocol Offset Helpers\\n * @notice Helper functions that simplify the carbon offsetting (retirement)\\n * process.\\n *\\n * Retiring carbon tokens requires multiple steps and interactions with\\n * Toucan Protocol's main contracts:\\n * 1. Obtain a pool token e.g., NCT (by performing a token\\n * swap on a DEX).\\n * 2. Redeem the pool token for a TCO2 token.\\n * 3. Retire the TCO2 token.\\n *\\n * These steps are combined in each of the following \\\"auto offset\\\" methods\\n * implemented in `OffsetHelper` to allow a retirement within one transaction:\\n * - `autoOffsetPoolToken()` if the user already owns a Toucan pool\\n * token e.g., NCT,\\n * - `autoOffsetExactOutETH()` if the user would like to perform a retirement\\n * using native tokens e.g., MATIC, specifying the exact amount of TCO2s to retire (only on Polygon, not on Celo),\\n * - `autoOffsetExactInETH()` if the user would like to perform a retirement\\n * using native tokens, swapping all sent native tokens into TCO2s (only on Polygon, not on Celo),\\n * - `autoOffsetExactOutToken()` if the user would like to perform a retirement\\n * using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount\\n * of TCO2s to retire,\\n * - `autoOffsetExactInToken()` if the user would like to perform a retirement\\n * using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount\\n * of token to swap into TCO2s.\\n *\\n * In these methods, \\\"auto\\\" refers to the fact that these methods use\\n * `autoRedeem()` in order to automatically choose a TCO2 token corresponding\\n * to the oldest tokenized carbon project in the specfified token pool.\\n * There are no fees incurred by the user when using `autoRedeem()`, i.e., the\\n * user receives 1 TCO2 token for each pool token (BCT/NCT) redeemed.\\n *\\n * There are two `view` helper functions `calculateNeededETHAmount()` and\\n * `calculateNeededTokenAmount()` that should be called before using\\n * `autoOffsetExactOutETH()` and `autoOffsetExactOutToken()`, to determine how\\n * much native tokens e.g., MATIC, respectively how much of the ERC20 token must be sent to the\\n * `OffsetHelper` contract in order to retire the specified amount of carbon.\\n *\\n * The two `view` helper functions `calculateExpectedPoolTokenForETH()` and\\n * `calculateExpectedPoolTokenForToken()` can be used to calculate the\\n * expected amount of TCO2s that will be offset using functions\\n * `autoOffsetExactInETH()` and `autoOffsetExactInToken()`.\\n */\\ncontract OffsetHelper is OffsetHelperStorage {\\n using SafeERC20 for IERC20;\\n // As Celo allows to pay the gas fees with other tokens than the native token,\\n // it's not possible ot use the swapETH (swap native tokens) functions.\\n uint256 private constant CELO_MAINNET_CHAINID = 42220;\\n uint256 private constant ALFAJORES_MAINNET_CHAINID = 44787;\\n\\n /**\\n * @notice Emitted upon successful redemption of TCO2 tokens from a Toucan\\n * pool token e.g., NCT.\\n *\\n * @param sender The sender of the transaction\\n * @param poolToken The address of the pool token used in the\\n * redemption, e.g., NCT\\n * @param tco2s An array of the TCO2 addresses that were redeemed\\n * @param amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n event Redeemed(\\n address sender,\\n address poolToken,\\n address[] tco2s,\\n uint256[] amounts\\n );\\n\\n modifier onlyRedeemable(address _token) {\\n require(isRedeemable(_token), \\\"Token not redeemable.\\\");\\n\\n _;\\n }\\n\\n modifier onlySwappable(address _token) {\\n require(isSwappable(_token), \\\"Path doesn't yet exist.\\\");\\n\\n _;\\n }\\n\\n modifier isNotCelo() {\\n require(\\n block.chainid != CELO_MAINNET_CHAINID &&\\n block.chainid != ALFAJORES_MAINNET_CHAINID,\\n \\\"The function is not available on Celo.\\\"\\n );\\n\\n _;\\n }\\n\\n /**\\n * @notice Contract constructor. Should specify arrays of ERC20 symbols and\\n * addresses that can used by the contract.\\n *\\n * @dev See `isEligible()` for a list of tokens that can be used in the\\n * contract. These can be modified after deployment by the contract owner\\n * using `setEligibleTokenAddress()` and `deleteEligibleTokenAddress()`.\\n *\\n * @param _poolAddresses A list of pool token addresses.\\n * @param _tokenSymbolsForPaths An array of symbols of the token the user want to retire carbon credits for\\n * @param _paths An array of arrays of addresses to describe the path needed to swap form the baseToken to the pool Token\\n * to the provided token symbols.\\n */\\n constructor(\\n address[] memory _poolAddresses,\\n string[] memory _tokenSymbolsForPaths,\\n address[][] memory _paths,\\n address _dexRouterAddress\\n ) {\\n poolAddresses = _poolAddresses;\\n tokenSymbolsForPaths = _tokenSymbolsForPaths;\\n paths = _paths;\\n dexRouterAddress = _dexRouterAddress;\\n\\n uint256 eligibleSwapPathsBySymbolLen = _tokenSymbolsForPaths.length;\\n for (uint256 i; i < eligibleSwapPathsBySymbolLen; i++) {\\n eligibleSwapPaths[_paths[i][0]] = _paths[i];\\n eligibleSwapPathsBySymbol[_tokenSymbolsForPaths[i]] = _paths[i];\\n }\\n }\\n\\n // The receive and fallback method are needed to fix the situation where transfering dust native tokens\\n // in the native tokens to token swap fails\\n receive() external payable {}\\n\\n // ----------------------------------------\\n // Public functions\\n // ----------------------------------------\\n\\n /**\\n * @notice Retire carbon credits using the oldest TCO2\\n * tokens available from the specified Toucan token pool by sending ERC20\\n * tokens (cUSD, USDC, WETH, WMATIC). Use `calculateNeededTokenAmount` first in\\n * order to find out how much of the ERC20 token is required to retire the\\n * specified quantity of TCO2.\\n *\\n * This function:\\n * 1. Swaps the ERC20 token sent to the contract for the specified pool token.\\n * 2. Redeems the pool token for the oldest TCO2 tokens available.\\n * 3. Retires the TCO2 tokens.\\n *\\n * Note: The client must approve the ERC20 token that is sent to the contract.\\n *\\n * @dev When automatically redeeming pool tokens for the oldest ones\\n * TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool\\n * token.\\n *\\n * @param _fromToken The address of the ERC20 token that the user sends\\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\\n * @param _poolToken The address of the pool token that the\\n * user wants to use, e.g., NCT\\n * @param _amountToOffset The amount of TCO2 to offset\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetExactOutToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _amountToOffset\\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\\n // swap input token for BCT / NCT\\n swapExactOutToken(_fromToken, _poolToken, _amountToOffset);\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire carbon credits using the oldest TCO2\\n * tokens available from the specified Toucan token pool by sending ERC20\\n * tokens (cUSD, USDC, WETH, WMATIC). All provided token is consumed for\\n * offsetting. Use `calculateExpectedPoolTokenForToken()` to calculate the expected amount\\n * of Pool token that can be acquired by swapping the provided amount of ERC20 token.\\n *\\n * This function:\\n * 1. Swaps the ERC20 token sent to the contract for the specified pool token.\\n * 2. Redeems the pool token for the oldest TCO2 tokens available.\\n * 3. Retires the TCO2 tokens.\\n *\\n * Note: The client must approve the ERC20 token that is sent to the contract.\\n *\\n * @dev When automatically redeeming pool tokens for the oldest ones\\n * TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool\\n * token.\\n *\\n * @param _fromToken The address of the ERC20 token that the user sends\\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\\n * @param _poolToken The address of the pool token that the\\n * user wants to use, e.g., NCT\\n * @param _amountToSwap The amount of ERC20 token to swap into Toucan pool\\n * token. Full amount will be used for offsetting.\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetExactInToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _amountToSwap\\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\\n // swap input token for BCT / NCT\\n uint256 amountToOffset = swapExactInToken(\\n _fromToken,\\n _poolToken,\\n _amountToSwap\\n );\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire carbon credits using the oldest TCO2\\n * tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC.\\n * Use `calculateNeededETHAmount()` first in order to find out how much\\n * native tokens are required to retire the specified quantity of TCO2.\\n *\\n * This function:\\n * 1. Swaps the Matic sent to the contract for the specified pool token.\\n * 2. Redeems the pool token for the oldest TCO2 tokens available.\\n * 3. Retires the TCO2 tokens.\\n *\\n * @dev If the user sends too much native tokens , the leftover amount will be sent back\\n * to the user. This function is only available on Polygon, not on Celo.\\n *\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _amountToOffset The amount of TCO2 to offset.\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetExactOutETH(\\n address _poolToken,\\n uint256 _amountToOffset\\n )\\n public\\n payable\\n isNotCelo\\n returns (address[] memory tco2s, uint256[] memory amounts)\\n {\\n // swap native tokens for BCT / NCT\\n swapExactOutETH(_poolToken, _amountToOffset);\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire carbon credits using the oldest TCO2\\n * tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC.\\n * All provided native tokens is consumed for offsetting.\\n * Use `calculateExpectedPoolTokenForETH()` to calculate the expected amount of\\n * Pool token that can be acquired by swapping the provided amount of native tokens e.g., MATIC.\\n *\\n * This function:\\n * 1. Swaps the Matic sent to the contract for the specified pool token.\\n * 2. Redeems the pool token for the oldest TCO2 tokens available.\\n * 3. Retires the TCO2 tokens.\\n *\\n * @dev This function is only available on Polygon, not on Celo.\\n *\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetExactInETH(\\n address _poolToken\\n )\\n public\\n payable\\n isNotCelo\\n returns (address[] memory tco2s, uint256[] memory amounts)\\n {\\n // swap native tokens for BCT / NCT\\n uint256 amountToOffset = swapExactInETH(_poolToken);\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire carbon credits using the oldest TCO2\\n * tokens available by sending pool tokens, e.g., NCT.\\n *\\n * This function:\\n * 1. Redeems the pool token for the oldest TCO2 tokens available.\\n * 2. Retires the TCO2 tokens.\\n *\\n * Note: The client must approve the pool token that is sent.\\n *\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _amountToOffset The amount of TCO2 to offset.\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetPoolToken(\\n address _poolToken,\\n uint256 _amountToOffset\\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\\n // deposit pool token from user to this contract\\n IERC20(_poolToken).safeTransferFrom(\\n msg.sender,\\n address(this),\\n _amountToOffset\\n );\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Redeems the specified amount of NCT / BCT for TCO2.\\n * @dev Needs to be approved on the client side\\n * @param _fromToken Could be the address of NCT\\n * @param _amount Amount to redeem\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoRedeem(\\n address _fromToken,\\n uint256 _amount\\n )\\n public\\n onlyRedeemable(_fromToken)\\n returns (address[] memory tco2s, uint256[] memory amounts)\\n {\\n require(\\n IERC20(_fromToken).balanceOf(address(this)) >= _amount,\\n \\\"Insufficient NCT/BCT balance\\\"\\n );\\n\\n // instantiate pool token (NCT)\\n IToucanPoolToken PoolTokenImplementation = IToucanPoolToken(_fromToken);\\n\\n // auto redeem pool token for TCO2; will transfer automatically picked TCO2 to this contract\\n (tco2s, amounts) = PoolTokenImplementation.redeemAuto2(_amount);\\n\\n emit Redeemed(msg.sender, _fromToken, tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire the specified TCO2 tokens.\\n * @param _tco2s The addresses of the TCO2s to retire\\n * @param _amounts The amounts to retire from each of the corresponding\\n * TCO2 addresses\\n */\\n function autoRetire(\\n address[] memory _tco2s,\\n uint256[] memory _amounts\\n ) public {\\n uint256 tco2sLen = _tco2s.length;\\n require(tco2sLen != 0, \\\"Array empty\\\");\\n\\n require(tco2sLen == _amounts.length, \\\"Arrays unequal\\\");\\n\\n for (uint i = 0; i < tco2sLen; i++) {\\n if (_amounts[i] == 0) {\\n continue;\\n }\\n require(\\n IERC20(_tco2s[i]).balanceOf(address(this)) >= _amounts[i],\\n \\\"Insufficient TCO2 balance\\\"\\n );\\n\\n IToucanCarbonOffsets(_tco2s[i]).retire(_amounts[i]);\\n }\\n }\\n\\n /**\\n * @notice Swap eligible ERC20 tokens for pool tokens (BCT/NCT) on SushiSwap\\n * @dev Needs to be approved on the client side\\n * @param _fromToken The address of the ERC20 token used for the swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _toAmount The required amount of the pool token (NCT/BCT)\\n */\\n function swapExactOutToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _toAmount\\n ) public onlySwappable(_fromToken) onlyRedeemable(_poolToken) {\\n // calculate path & amounts\\n (\\n address[] memory path,\\n uint256[] memory expAmounts\\n ) = calculateExactOutSwap(_fromToken, _poolToken, _toAmount);\\n uint256 amountIn = expAmounts[0];\\n\\n // transfer tokens\\n IERC20(_fromToken).safeTransferFrom(\\n msg.sender,\\n address(this),\\n amountIn\\n );\\n\\n // approve router\\n IERC20(_fromToken).approve(dexRouterAddress, amountIn);\\n\\n // swap\\n uint256[] memory amounts = dexRouter().swapTokensForExactTokens(\\n _toAmount,\\n amountIn, // max. input amount\\n path,\\n address(this),\\n block.timestamp\\n );\\n\\n // remove remaining approval if less input token was consumed\\n if (amounts[0] < amountIn) {\\n IERC20(_fromToken).approve(dexRouterAddress, 0);\\n }\\n }\\n\\n /**\\n * @notice Swap eligible ERC20 tokens for pool tokens (BCT/NCT) on\\n * SushiSwap. All provided ERC20 tokens will be swapped.\\n * @dev Needs to be approved on the client side.\\n * @param _fromToken The address of the ERC20 token used for the swap\\n * @param _poolToken The address of the pool token to swap for,\\n * @param _fromAmount The amount of ERC20 token to swap\\n * e.g., NCT\\n * @return amountOut Resulting amount of pool token that got acquired for the\\n * swapped ERC20 tokens.\\n */\\n function swapExactInToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _fromAmount\\n )\\n public\\n onlySwappable(_fromToken)\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountOut)\\n {\\n // calculate path & amounts\\n address[] memory path = generatePath(_fromToken, _poolToken);\\n\\n uint256 len = path.length;\\n\\n // transfer tokens\\n IERC20(_fromToken).safeTransferFrom(\\n msg.sender,\\n address(this),\\n _fromAmount\\n );\\n\\n // approve router\\n IERC20(_fromToken).safeApprove(dexRouterAddress, _fromAmount);\\n\\n // swap\\n uint256[] memory amounts = dexRouter().swapExactTokensForTokens(\\n _fromAmount,\\n 0, // min. output amount\\n path,\\n address(this),\\n block.timestamp\\n );\\n amountOut = amounts[len - 1];\\n }\\n\\n /**\\n * @notice Swap native tokens e.g., MATIC for pool tokens (BCT/NCT) on SushiSwap.\\n * Remaining native tokens that was not consumed by the swap is returned.\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _toAmount The required amount of the pool token (NCT/BCT)\\n */\\n function swapExactOutETH(\\n address _poolToken,\\n uint256 _toAmount\\n ) public payable isNotCelo onlyRedeemable(_poolToken) {\\n // create path & amounts\\n // wrap the native token\\n address fromToken = eligibleSwapPathsBySymbol[\\\"WMATIC\\\"][0];\\n address[] memory path = generatePath(fromToken, _poolToken);\\n\\n // swap\\n uint256[] memory amounts = dexRouter().swapETHForExactTokens{\\n value: msg.value\\n }(_toAmount, path, address(this), block.timestamp);\\n\\n // send surplus back\\n if (msg.value > amounts[0]) {\\n uint256 leftoverETH = msg.value - amounts[0];\\n (bool success, ) = msg.sender.call{value: leftoverETH}(\\n new bytes(0)\\n );\\n\\n require(success, \\\"Failed to send surplus back\\\");\\n }\\n }\\n\\n /**\\n * @notice Swap native tokens e.g., MATIC for pool tokens (BCT/NCT) on SushiSwap. All\\n * provided native tokens will be swapped.\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @return amountOut Resulting amount of pool token that got acquired for the\\n * swapped native tokens .\\n */\\n function swapExactInETH(\\n address _poolToken\\n )\\n public\\n payable\\n isNotCelo\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountOut)\\n {\\n // create path & amounts\\n uint256 fromAmount = msg.value;\\n // wrap the native token\\n address fromToken = eligibleSwapPathsBySymbol[\\\"WMATIC\\\"][0];\\n address[] memory path = generatePath(fromToken, _poolToken);\\n\\n uint256 len = path.length;\\n\\n // swap\\n uint256[] memory amounts = dexRouter().swapExactETHForTokens{\\n value: fromAmount\\n }(0, path, address(this), block.timestamp);\\n amountOut = amounts[len - 1];\\n }\\n\\n // ----------------------------------------\\n // Public view functions\\n // ----------------------------------------\\n\\n /**\\n * @notice Return how much of the specified ERC20 token is required in\\n * order to swap for the desired amount of a pool token, for\\n * example, e.g., NCT.\\n *\\n * @param _fromToken The address of the ERC20 token used for the swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _toAmount The desired amount of pool token to receive\\n * @return amountIn The amount of the ERC20 token required in order to\\n * swap for the specified amount of the pool token\\n */\\n function calculateNeededTokenAmount(\\n address _fromToken,\\n address _poolToken,\\n uint256 _toAmount\\n )\\n public\\n view\\n onlySwappable(_fromToken)\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountIn)\\n {\\n (, uint256[] memory amounts) = calculateExactOutSwap(\\n _fromToken,\\n _poolToken,\\n _toAmount\\n );\\n amountIn = amounts[0];\\n }\\n\\n /**\\n * @notice Return how much native tokens e.g, MATIC is required in order to swap for the\\n * desired amount of a pool token, e.g., NCT.\\n * @param _poolToken The address of the pool token to swap for, for\\n * example, NCT\\n * @param _toAmount The desired amount of pool token to receive\\n * @return amountIn The amount of native tokens required in order to swap for\\n * the specified amount of the pool token\\n */\\n function calculateNeededETHAmount(\\n address _poolToken,\\n uint256 _toAmount\\n ) public view onlyRedeemable(_poolToken) returns (uint256 amountIn) {\\n address fromToken = eligibleSwapPathsBySymbol[\\\"WMATIC\\\"][0];\\n (, uint256[] memory amounts) = calculateExactOutSwap(\\n fromToken,\\n _poolToken,\\n _toAmount\\n );\\n amountIn = amounts[0];\\n }\\n\\n /**\\n * @notice Calculates the expected amount of pool token that can be\\n * acquired by swapping the provided amount of ERC20 token.\\n *\\n * @param _fromToken The address of the ERC20 token used for the swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _fromAmount The amount of ERC20 token to swap\\n * @return amountOut The expected amount of Pool token that can be acquired\\n */\\n function calculateExpectedPoolTokenForToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _fromAmount\\n )\\n public\\n view\\n onlySwappable(_fromToken)\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountOut)\\n {\\n (, uint256[] memory amounts) = calculateExactInSwap(\\n _fromToken,\\n _poolToken,\\n _fromAmount\\n );\\n amountOut = amounts[amounts.length - 1];\\n }\\n\\n /**\\n * @notice Calculates the expected amount of pool token that can be\\n * acquired by swapping the provided amount of native tokens e.g., MATIC.\\n *\\n * @param _fromTokenAmount The amount of native tokens to swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @return amountOut The expected amount of Pool token that can be acquired\\n */\\n function calculateExpectedPoolTokenForETH(\\n address _poolToken,\\n uint256 _fromTokenAmount\\n )\\n public\\n view\\n isNotCelo\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountOut)\\n {\\n address fromToken = eligibleSwapPathsBySymbol[\\\"WMATIC\\\"][0];\\n (, uint256[] memory amounts) = calculateExactInSwap(\\n fromToken,\\n _poolToken,\\n _fromTokenAmount\\n );\\n amountOut = amounts[amounts.length - 1];\\n }\\n\\n // ----------------------------------------\\n // Internal functions\\n // ----------------------------------------\\n\\n function calculateExactOutSwap(\\n address _fromToken,\\n address _poolToken,\\n uint256 _toAmount\\n ) internal view returns (address[] memory path, uint256[] memory amounts) {\\n // create path & calculate amounts\\n path = generatePath(_fromToken, _poolToken);\\n uint256 len = path.length;\\n\\n amounts = dexRouter().getAmountsIn(_toAmount, path);\\n\\n // sanity check arrays\\n require(len == amounts.length, \\\"Arrays unequal\\\");\\n require(_toAmount == amounts[len - 1], \\\"Output amount mismatch\\\");\\n }\\n\\n function calculateExactInSwap(\\n address _fromToken,\\n address _poolToken,\\n uint256 _fromAmount\\n ) internal view returns (address[] memory path, uint256[] memory amounts) {\\n // create path & calculate amounts\\n path = generatePath(_fromToken, _poolToken);\\n uint256 len = path.length;\\n\\n amounts = dexRouter().getAmountsOut(_fromAmount, path);\\n\\n // sanity check arrays\\n require(len == amounts.length, \\\"Arrays unequal\\\");\\n require(_fromAmount == amounts[0], \\\"Input amount mismatch\\\");\\n }\\n\\n /**\\n * @notice Show all pool token addresses that can be used to retired.\\n * @param _fromToken a list of token symbols that can be retired.\\n * @param _toToken a list of token symbols that can be retired.\\n */\\n function generatePath(\\n address _fromToken,\\n address _toToken\\n ) internal view returns (address[] memory path) {\\n uint256 len = eligibleSwapPaths[_fromToken].length;\\n if (len == 1) {\\n path = new address[](2);\\n path[0] = _fromToken;\\n path[1] = _toToken;\\n return path;\\n }\\n if (len == 2) {\\n path = new address[](3);\\n path[0] = _fromToken;\\n path[1] = eligibleSwapPaths[_fromToken][1];\\n path[2] = _toToken;\\n return path;\\n }\\n if (len == 3) {\\n path = new address[](3);\\n path[0] = _fromToken;\\n path[1] = eligibleSwapPaths[_fromToken][1];\\n path[2] = eligibleSwapPaths[_fromToken][2];\\n path[3] = _toToken;\\n return path;\\n } else {\\n path = new address[](4);\\n path[0] = _fromToken;\\n path[1] = eligibleSwapPaths[_fromToken][1];\\n path[2] = eligibleSwapPaths[_fromToken][2];\\n path[3] = eligibleSwapPaths[_fromToken][3];\\n path[4] = _toToken;\\n return path;\\n }\\n }\\n\\n function dexRouter() internal view returns (IUniswapV2Router02) {\\n return IUniswapV2Router02(dexRouterAddress);\\n }\\n\\n // ----------------------------------------\\n // Private functions\\n // ----------------------------------------\\n\\n /**\\n * @notice Checks whether an address is a pool token address\\n * @param _erc20Address address of token to be checked\\n * @return True if the address is a pool token address\\n */\\n function isRedeemable(address _erc20Address) private view returns (bool) {\\n for (uint i = 0; i < poolAddresses.length; i++) {\\n if (poolAddresses[i] == _erc20Address) {\\n return true;\\n }\\n }\\n\\n return false;\\n }\\n\\n /**\\n * @notice Checks whether an address can be used in a token swap\\n * @param _erc20Address address of token to be checked\\n * @return True if the specified address can be used in a swap\\n */\\n function isSwappable(address _erc20Address) private view returns (bool) {\\n for (uint i = 0; i < paths.length; i++) {\\n if (paths[i][0] == _erc20Address) {\\n return true;\\n }\\n }\\n\\n return false;\\n }\\n\\n // ----------------------------------------\\n // Admin methods\\n // ----------------------------------------\\n\\n /**\\n * @notice Checks if ERC20 Token is eligible for Offsetting.\\n * @param _erc20Address The address of the ERC20 token that the user sends\\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\\n * @return _path Returns the path of the token to be exchanged\\n */\\n\\n function isERC20AddressEligible(\\n address _erc20Address\\n ) public view returns (address[] memory _path) {\\n _path = eligibleSwapPaths[_erc20Address];\\n }\\n\\n /**\\n * @notice Change or add eligible paths and their addresses.\\n * @param _tokenSymbol The symbol of the token to add\\n * @param _path The path of the path to add\\n */\\n function addPath(\\n string memory _tokenSymbol,\\n address[] memory _path\\n ) public virtual onlyOwner {\\n eligibleSwapPaths[_path[0]] = _path;\\n eligibleSwapPathsBySymbol[_tokenSymbol] = _path;\\n tokenSymbolsForPaths.push(_tokenSymbol);\\n }\\n\\n /**\\n * @notice Delete eligible tokens stored in the contract.\\n * @param _tokenSymbol The symbol of the path to remove\\n */\\n function removePath(string memory _tokenSymbol) public virtual onlyOwner {\\n delete eligibleSwapPaths[eligibleSwapPathsBySymbol[_tokenSymbol][0]];\\n delete eligibleSwapPathsBySymbol[_tokenSymbol];\\n }\\n\\n /**\\n * @notice Cheks if Pool Token is eligible for Offsetting.\\n * @param _poolToken The addresses of the pool token to redeem\\n * @return _isEligible Returns if token can be redeemed\\n */\\n\\n function isPoolAddressEligible(\\n address _poolToken\\n ) public view returns (bool _isEligible) {\\n _isEligible = isRedeemable(_poolToken);\\n }\\n\\n /**\\n * @notice Change or add pool token addresses.\\n * @param _poolToken The address of the pool token to add\\n */\\n function addPoolToken(address _poolToken) public virtual onlyOwner {\\n poolAddresses.push(_poolToken);\\n }\\n\\n /**\\n * @notice Delete eligible pool token addresses stored in the contract.\\n * @param _poolToken The address of the pool token to remove\\n */\\n function removePoolToken(address _poolToken) public virtual onlyOwner {\\n for (uint256 i; i < poolAddresses.length; i++) {\\n if (poolAddresses[i] == _poolToken) {\\n poolAddresses[i] = poolAddresses[poolAddresses.length - 1];\\n poolAddresses.pop();\\n break;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf85a61eab51c68683a095be0c776a9a99bf70aa2dc5c65863176be9c17fb0c12\",\"license\":\"GPL-3.0\"},\"contracts/OffsetHelperStorage.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2022 Toucan Labs\\n//\\n// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract OffsetHelperStorage is Ownable {\\n // token symbol => token address\\n mapping(address => address[]) public eligibleSwapPaths;\\n mapping(string => address[]) public eligibleSwapPathsBySymbol;\\n\\n address[] public poolAddresses;\\n string[] public tokenSymbolsForPaths;\\n address[][] public paths;\\n address public dexRouterAddress;\\n}\\n\",\"keccak256\":\"0x6cd0dc999b167d00debeec534e1637cbefa552bdb801e672a20915b90bab20d0\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IToucanCarbonOffsets.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\\\";\\n\\nimport \\\"../types/CarbonProjectTypes.sol\\\";\\nimport \\\"../types/CarbonProjectVintageTypes.sol\\\";\\n\\ninterface IToucanCarbonOffsets is IERC20Upgradeable, IERC721Receiver {\\n function getGlobalProjectVintageIdentifiers()\\n external\\n view\\n returns (string memory, string memory);\\n\\n function getAttributes()\\n external\\n view\\n returns (ProjectData memory, VintageData memory);\\n\\n function getRemaining() external view returns (uint256 remaining);\\n\\n function getDepositCap() external view returns (uint256);\\n\\n function retire(uint256 amount) external;\\n\\n function retireFrom(address account, uint256 amount) external;\\n\\n function mintCertificateLegacy(\\n string calldata retiringEntityString,\\n address beneficiary,\\n string calldata beneficiaryString,\\n string calldata retirementMessage,\\n uint256 amount\\n ) external;\\n\\n function retireAndMintCertificate(\\n string calldata retiringEntityString,\\n address beneficiary,\\n string calldata beneficiaryString,\\n string calldata retirementMessage,\\n uint256 amount\\n ) external;\\n}\\n\",\"keccak256\":\"0x46c4ed2acd84764d0dd68c9c475e2c6ec3229a686046db48aca77ccd298d4b48\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/IToucanContractRegistry.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\npragma solidity ^0.8.0;\\n\\ninterface IToucanContractRegistry {\\n function carbonOffsetBatchesAddress() external view returns (address);\\n\\n function carbonProjectsAddress() external view returns (address);\\n\\n function carbonProjectVintagesAddress() external view returns (address);\\n\\n function toucanCarbonOffsetsFactoryAddress()\\n external\\n view\\n returns (address);\\n\\n function carbonOffsetBadgesAddress() external view returns (address);\\n\\n function checkERC20(address _address) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xa8451ff2527948e4eed26e97247b979212ccb3bd89506302b6c09ddbad392035\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/IToucanPoolToken.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\n\\ninterface IToucanPoolToken is IERC20Upgradeable {\\n function deposit(address erc20Addr, uint256 amount) external;\\n\\n function checkEligible(address erc20Addr) external view returns (bool);\\n\\n function checkAttributeMatching(address erc20Addr)\\n external\\n view\\n returns (bool);\\n\\n function calculateRedeemFees(\\n address[] memory tco2s,\\n uint256[] memory amounts\\n ) external view returns (uint256);\\n\\n function redeemMany(address[] memory tco2s, uint256[] memory amounts)\\n external;\\n\\n function redeemAuto(uint256 amount) external;\\n\\n function redeemAuto2(uint256 amount)\\n external\\n returns (address[] memory tco2s, uint256[] memory amounts);\\n\\n function getRemaining() external view returns (uint256);\\n\\n function getScoredTCO2s() external view returns (address[] memory);\\n}\\n\",\"keccak256\":\"0xef39949a81cf4ed78d789a1aac5c5860de1582be70de7435f1671931091d43a7\",\"license\":\"UNLICENSED\"},\"contracts/types/CarbonProjectTypes.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @dev CarbonProject related data and attributes\\nstruct ProjectData {\\n string projectId;\\n string standard;\\n string methodology;\\n string region;\\n string storageMethod;\\n string method;\\n string emissionType;\\n string category;\\n string uri;\\n address controller;\\n}\\n\",\"keccak256\":\"0x10d52f79d4bb8dbfe0abbb1662059d6d0193fe5794977b66aacf741451e25401\",\"license\":\"UNLICENSED\"},\"contracts/types/CarbonProjectVintageTypes.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\nstruct VintageData {\\n /// @dev A human-readable string which differentiates this from other vintages in\\n /// the same project, and helps build the corresponding TCO2 name and symbol.\\n string name;\\n uint64 startTime; // UNIX timestamp\\n uint64 endTime; // UNIX timestamp\\n uint256 projectTokenId;\\n uint64 totalVintageQuantity;\\n bool isCorsiaCompliant;\\n bool isCCPcompliant;\\n string coBenefits;\\n string correspAdjustment;\\n string additionalCertification;\\n string uri;\\n}\\n\",\"keccak256\":\"0x3a52e88a48b87f1ca3992c201f8b786ccf3aeb74796510893f8e33b33eae251b\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b5060405162003c5338038062003c538339810160408190526200003491620005df565b6200003f3362000207565b83516200005490600390602087019062000257565b5082516200006a906004906020860190620002c1565b5081516200008090600590602085019062000321565b50600680546001600160a01b0319166001600160a01b038316179055825160005b81811015620001fb57838181518110620000cb57634e487b7160e01b600052603260045260246000fd5b602002602001015160016000868481518110620000f857634e487b7160e01b600052603260045260246000fd5b60200260200101516000815181106200012157634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002090805190602001906200015e92919062000257565b508381815181106200018057634e487b7160e01b600052603260045260246000fd5b60200260200101516002868381518110620001ab57634e487b7160e01b600052603260045260246000fd5b6020026020010151604051620001c2919062000756565b90815260200160405180910390209080519060200190620001e592919062000257565b5080620001f2816200083d565b915050620000a1565b5050505050506200087b565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b828054828255906000526020600020908101928215620002af579160200282015b82811115620002af57825182546001600160a01b0319166001600160a01b0390911617825560209092019160019091019062000278565b50620002bd92915062000381565b5090565b82805482825590600052602060002090810192821562000313579160200282015b828111156200031357825180516200030291849160209091019062000398565b5091602001919060010190620002e2565b50620002bd92915062000415565b82805482825590600052602060002090810192821562000373579160200282015b828111156200037357825180516200036291849160209091019062000257565b509160200191906001019062000342565b50620002bd92915062000436565b5b80821115620002bd576000815560010162000382565b828054620003a69062000800565b90600052602060002090601f016020900481019282620003ca5760008555620002af565b82601f10620003e557805160ff1916838001178555620002af565b82800160010185558215620002af579182015b82811115620002af578251825591602001919060010190620003f8565b80821115620002bd5760006200042c828262000457565b5060010162000415565b80821115620002bd5760006200044d828262000499565b5060010162000436565b508054620004659062000800565b6000825580601f1062000476575050565b601f01602090049060005260206000209081019062000496919062000381565b50565b508054600082559060005260206000209081019062000496919062000381565b80516001600160a01b0381168114620004d157600080fd5b919050565b600082601f830112620004e7578081fd5b8151602062000500620004fa83620007a7565b62000774565b80838252828201915082860187848660051b890101111562000520578586fd5b855b8581101562000549576200053682620004b9565b8452928401929084019060010162000522565b5090979650505050505050565b600082601f83011262000567578081fd5b815160206200057a620004fa83620007a7565b80838252828201915082860187848660051b89010111156200059a578586fd5b855b85811015620005495781516001600160401b03811115620005bb578788fd5b620005cb8a87838c0101620004d6565b85525092840192908401906001016200059c565b60008060008060808587031215620005f5578384fd5b84516001600160401b03808211156200060c578586fd5b6200061a88838901620004d6565b9550602087015191508082111562000630578485fd5b818701915087601f83011262000644578485fd5b815162000655620004fa82620007a7565b80828252602082019150602085018b60208560051b880101111562000678578889fd5b885b84811015620007105781518681111562000692578a8bfd5b8701603f81018e13620006a3578a8bfd5b602081015187811115620006bb57620006bb62000865565b620006d0601f8201601f191660200162000774565b8181528f6040838501011115620006e5578c8dfd5b620006f8826020830160408601620007cd565b8652505060209384019391909101906001016200067a565b505060408a015190975093505050808211156200072b578384fd5b506200073a8782880162000556565b9250506200074b60608601620004b9565b905092959194509250565b600082516200076a818460208701620007cd565b9190910192915050565b604051601f8201601f191681016001600160401b03811182821017156200079f576200079f62000865565b604052919050565b60006001600160401b03821115620007c357620007c362000865565b5060051b60200190565b60005b83811015620007ea578181015183820152602001620007d0565b83811115620007fa576000848401525b50505050565b600181811c908216806200081557607f821691505b602082108114156200083757634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156200085e57634e487b7160e01b81526011600452602481fd5b5060010190565b634e487b7160e01b600052604160045260246000fd5b6133c8806200088b6000396000f3fe6080604052600436106101d15760003560e01c80638da5cb5b116100f7578063c0681c3d11610095578063e7f67fb111610064578063e7f67fb11461054e578063f04ad9d71461056e578063f2fde38b14610581578063feb21b9c146105a157600080fd5b8063c0681c3d146104db578063c6c53efb146104fb578063d08ec4751461051b578063d8a90c401461053b57600080fd5b8063a0cd6049116100d1578063a0cd60491461044b578063a2844a861461046b578063b4e76a861461049b578063b8baf9db146104bb57600080fd5b80638da5cb5b146103ed5780639753209d1461040b578063a09457221461042b57600080fd5b80635367cd9c1161016f578063715018a61161013e578063715018a61461037857806373200b111461038d57806382155e7e146103ad5780638474c288146103cd57600080fd5b80635367cd9c146102eb57806356a7de0d146102fe57806368d306d91461031e5780636d4565041461034b57600080fd5b80631a0fdecc116101ab5780631a0fdecc1461026a5780632e98c8141461028a57806335bab7e5146102ab5780634865b2b4146102cb57600080fd5b80631109ec99146101dd5780631357b113146102105780631661f8181461024857600080fd5b366101d857005b600080fd5b3480156101e957600080fd5b506101fd6101f8366004612ca7565b6105c1565b6040519081526020015b60405180910390f35b34801561021c57600080fd5b5061023061022b366004612ca7565b610695565b6040516001600160a01b039091168152602001610207565b34801561025457600080fd5b50610268610263366004612cd2565b6106cd565b005b34801561027657600080fd5b506101fd610285366004612c67565b61094a565b61029d610298366004612ca7565b6109dd565b6040516102079291906130a4565b3480156102b757600080fd5b506101fd6102c6366004612c67565b610a3a565b3480156102d757600080fd5b506101fd6102e6366004612c67565b610ba8565b6102686102f9366004612ca7565b610c33565b34801561030a57600080fd5b50610268610319366004612c44565b610eb9565b34801561032a57600080fd5b5061033e610339366004612c44565b611005565b6040516102079190613091565b34801561035757600080fd5b5061036b610366366004612f74565b61107b565b6040516102079190613107565b34801561038457600080fd5b50610268611127565b34801561039957600080fd5b506102306103a8366004612f31565b61113b565b3480156103b957600080fd5b5061029d6103c8366004612ca7565b611166565b3480156103d957600080fd5b506102686103e8366004612c67565b611322565b3480156103f957600080fd5b506000546001600160a01b0316610230565b34801561041757600080fd5b50610268610426366004612ea7565b6115ae565b34801561043757600080fd5b5061029d610446366004612c67565b611652565b34801561045757600080fd5b5061029d610466366004612c67565b611686565b34801561047757600080fd5b5061048b610486366004612c44565b6116b5565b6040519015158152602001610207565b3480156104a757600080fd5b506101fd6104b6366004612ca7565b6116c6565b3480156104c757600080fd5b506102686104d6366004612eda565b6117ba565b3480156104e757600080fd5b506102686104f6366004612c44565b61189f565b34801561050757600080fd5b50610230610516366004612fa4565b6118f9565b34801561052757600080fd5b5061029d610536366004612ca7565b611921565b6101fd610549366004612c44565b611939565b34801561055a57600080fd5b50600654610230906001600160a01b031681565b61029d61057c366004612c44565b611adc565b34801561058d57600080fd5b5061026861059c366004612c44565b611b3b565b3480156105ad57600080fd5b506102306105bc366004612f74565b611bb1565b6000826105cd81611bdb565b6105f25760405162461bcd60e51b81526004016105e990613171565b60405180910390fd5b6000600260405161060f9065574d4154494360d01b815260060190565b908152602001604051809103902060008154811061063d57634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b0316915061065e828787611c53565b9150508060008151811061068257634e487b7160e01b600052603260045260246000fd5b6020026020010151935050505092915050565b600160205281600052604060002081815481106106b157600080fd5b6000918252602090912001546001600160a01b03169150829050565b81518061070a5760405162461bcd60e51b815260206004820152600b60248201526a417272617920656d70747960a81b60448201526064016105e9565b8151811461072a5760405162461bcd60e51b81526004016105e9906131a0565b60005b818110156109445782818151811061075557634e487b7160e01b600052603260045260246000fd5b60200260200101516000141561076a57610932565b82818151811061078a57634e487b7160e01b600052603260045260246000fd5b60200260200101518482815181106107b257634e487b7160e01b600052603260045260246000fd5b60209081029190910101516040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b1580156107fd57600080fd5b505afa158015610811573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108359190612f8c565b10156108835760405162461bcd60e51b815260206004820152601960248201527f496e73756666696369656e742054434f322062616c616e63650000000000000060448201526064016105e9565b8381815181106108a357634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316633790cf578483815181106108d957634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b81526004016108ff91815260200190565b600060405180830381600087803b15801561091957600080fd5b505af115801561092d573d6000803e3d6000fd5b505050505b8061093c81613336565b91505061072d565b50505050565b60008361095681611d93565b6109725760405162461bcd60e51b81526004016105e99061313a565b8361097c81611bdb565b6109985760405162461bcd60e51b81526004016105e990613171565b60006109a5878787611c53565b915050806000815181106109c957634e487b7160e01b600052603260045260246000fd5b602002602001015193505050509392505050565b60608061a4ec46141580156109f4575061aef34614155b610a105760405162461bcd60e51b81526004016105e9906131c8565b610a1a8484610c33565b610a248484611166565b9092509050610a3382826106cd565b9250929050565b600083610a4681611d93565b610a625760405162461bcd60e51b81526004016105e99061313a565b83610a6c81611bdb565b610a885760405162461bcd60e51b81526004016105e990613171565b6000610a948787611e2c565b8051909150610aae6001600160a01b03891633308961242a565b600654610ac8906001600160a01b038a8116911688612495565b6000610adc6006546001600160a01b031690565b6001600160a01b03166338ed17398860008630426040518663ffffffff1660e01b8152600401610b10959493929190613227565b600060405180830381600087803b158015610b2a57600080fd5b505af1158015610b3e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b669190810190612e54565b905080610b746001846132b8565b81518110610b9257634e487b7160e01b600052603260045260246000fd5b6020026020010151955050505050509392505050565b600083610bb481611d93565b610bd05760405162461bcd60e51b81526004016105e99061313a565b83610bda81611bdb565b610bf65760405162461bcd60e51b81526004016105e990613171565b6000610c038787876125b9565b9150508060018251610c1591906132b8565b815181106109c957634e487b7160e01b600052603260045260246000fd5b61a4ec4614158015610c47575061aef34614155b610c635760405162461bcd60e51b81526004016105e9906131c8565b81610c6d81611bdb565b610c895760405162461bcd60e51b81526004016105e990613171565b60006002604051610ca69065574d4154494360d01b815260060190565b9081526020016040518091039020600081548110610cd457634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b03169150610cf48286611e2c565b90506000610d0a6006546001600160a01b031690565b6001600160a01b031663fb3bdb4134878530426040518663ffffffff1660e01b8152600401610d3c94939291906130d2565b6000604051808303818588803b158015610d5557600080fd5b505af1158015610d69573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052610d929190810190612e54565b905080600081518110610db557634e487b7160e01b600052603260045260246000fd5b6020026020010151341115610eb157600081600081518110610de757634e487b7160e01b600052603260045260246000fd5b602002602001015134610dfa91906132b8565b604080516000808252602082019283905292935033918491610e1b91613037565b60006040518083038185875af1925050503d8060008114610e58576040519150601f19603f3d011682016040523d82523d6000602084013e610e5d565b606091505b5050905080610eae5760405162461bcd60e51b815260206004820152601b60248201527f4661696c656420746f2073656e6420737572706c7573206261636b000000000060448201526064016105e9565b50505b505050505050565b610ec16126ef565b60005b60035481101561100157816001600160a01b031660038281548110610ef957634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415610fef5760038054610f24906001906132b8565b81548110610f4257634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600380546001600160a01b039092169183908110610f7c57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506003805480610fc957634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b03191690550190555050565b80610ff981613336565b915050610ec4565b5050565b6001600160a01b03811660009081526001602090815260409182902080548351818402810184019094528084526060939283018282801561106f57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611051575b50505050509050919050565b6004818154811061108b57600080fd5b9060005260206000200160009150905080546110a6906132fb565b80601f01602080910402602001604051908101604052809291908181526020018280546110d2906132fb565b801561111f5780601f106110f45761010080835404028352916020019161111f565b820191906000526020600020905b81548152906001019060200180831161110257829003601f168201915b505050505081565b61112f6126ef565b6111396000612749565b565b815160208184018101805160028252928201918501919091209190528054829081106106b157600080fd5b6060808361117381611bdb565b61118f5760405162461bcd60e51b81526004016105e990613171565b6040516370a0823160e01b815230600482015284906001600160a01b038716906370a082319060240160206040518083038186803b1580156111d057600080fd5b505afa1580156111e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112089190612f8c565b10156112565760405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e74204e43542f4243542062616c616e63650000000060448201526064016105e9565b604051634c02cad160e01b81526004810185905285906001600160a01b03821690634c02cad190602401600060405180830381600087803b15801561129a57600080fd5b505af11580156112ae573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526112d69190810190612d8e565b60405191955093507f3d29f82a20ec733db9f357c4dc1ae0ee60c572cc4b877384aa4639e4d877b18890611311903390899088908890613053565b60405180910390a150509250929050565b8261132c81611d93565b6113485760405162461bcd60e51b81526004016105e99061313a565b8261135281611bdb565b61136e5760405162461bcd60e51b81526004016105e990613171565b60008061137c878787611c53565b915091506000816000815181106113a357634e487b7160e01b600052603260045260246000fd5b602090810291909101015190506113c56001600160a01b03891633308461242a565b60065460405163095ea7b360e01b81526001600160a01b039182166004820152602481018390529089169063095ea7b390604401602060405180830381600087803b15801561141357600080fd5b505af1158015611427573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144b9190612e87565b5060006114606006546001600160a01b031690565b6001600160a01b0316638803dbee88848730426040518663ffffffff1660e01b8152600401611493959493929190613227565b600060405180830381600087803b1580156114ad57600080fd5b505af11580156114c1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526114e99190810190612e54565b9050818160008151811061150d57634e487b7160e01b600052603260045260246000fd5b602002602001015110156115a35760065460405163095ea7b360e01b81526001600160a01b03918216600482015260006024820152908a169063095ea7b390604401602060405180830381600087803b15801561156957600080fd5b505af115801561157d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a19190612e87565b505b505050505050505050565b6115b66126ef565b600160006002836040516115ca9190613037565b90815260200160405180910390206000815481106115f857634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528201929092526040018120611625916129f8565b6002816040516116359190613037565b9081526020016040518091039020600061164f91906129f8565b50565b6060806000611662868686610a3a565b905061166e8582611166565b909350915061167d83836106cd565b50935093915050565b606080611694858585611322565b61169e8484611166565b90925090506116ad82826106cd565b935093915050565b60006116c082611bdb565b92915050565b600061a4ec46141580156116dc575061aef34614155b6116f85760405162461bcd60e51b81526004016105e9906131c8565b8261170281611bdb565b61171e5760405162461bcd60e51b81526004016105e990613171565b6000600260405161173b9065574d4154494360d01b815260060190565b908152602001604051809103902060008154811061176957634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b0316915061178a8287876125b9565b915050806001825161179c91906132b8565b8151811061068257634e487b7160e01b600052603260045260246000fd5b6117c26126ef565b8060016000836000815181106117e857634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000209080519060200190611823929190612a16565b50806002836040516118359190613037565b90815260200160405180910390209080519060200190611856929190612a16565b5060048054600181018255600091909152825161189a917f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b01906020850190612a7b565b505050565b6118a76126ef565b600380546001810182556000919091527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b0319166001600160a01b0392909216919091179055565b6005828154811061190957600080fd5b9060005260206000200181815481106106b157600080fd5b606080610a1a6001600160a01b03851633308661242a565b600061a4ec461415801561194f575061aef34614155b61196b5760405162461bcd60e51b81526004016105e9906131c8565b8161197581611bdb565b6119915760405162461bcd60e51b81526004016105e990613171565b60405165574d4154494360d01b8152349060009060029060060190815260200160405180910390206000815481106119d957634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b031691506119f98287611e2c565b80519091506000611a126006546001600160a01b031690565b6001600160a01b0316637ff36ab58660008630426040518663ffffffff1660e01b8152600401611a4594939291906130d2565b6000604051808303818588803b158015611a5e57600080fd5b505af1158015611a72573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052611a9b9190810190612e54565b905080611aa96001846132b8565b81518110611ac757634e487b7160e01b600052603260045260246000fd5b60200260200101519650505050505050919050565b60608061a4ec4614158015611af3575061aef34614155b611b0f5760405162461bcd60e51b81526004016105e9906131c8565b6000611b1a84611939565b9050611b268482611166565b9093509150611b3583836106cd565b50915091565b611b436126ef565b6001600160a01b038116611ba85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105e9565b61164f81612749565b60038181548110611bc157600080fd5b6000918252602090912001546001600160a01b0316905081565b6000805b600354811015611c4a57826001600160a01b031660038281548110611c1457634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415611c385750600192915050565b80611c4281613336565b915050611bdf565b50600092915050565b606080611c608585611e2c565b8051909250611c776006546001600160a01b031690565b6001600160a01b0316631f00ca7485856040518363ffffffff1660e01b8152600401611ca492919061320e565b60006040518083038186803b158015611cbc57600080fd5b505afa158015611cd0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611cf89190810190612e54565b915081518114611d1a5760405162461bcd60e51b81526004016105e9906131a0565b81611d266001836132b8565b81518110611d4457634e487b7160e01b600052603260045260246000fd5b6020026020010151841461167d5760405162461bcd60e51b815260206004820152601660248201527509eeae8e0eae840c2dadeeadce840dad2e6dac2e8c6d60531b60448201526064016105e9565b6000805b600554811015611c4a57826001600160a01b031660058281548110611dcc57634e487b7160e01b600052603260045260246000fd5b90600052602060002001600081548110611df657634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415611e1a5750600192915050565b80611e2481613336565b915050611d97565b6001600160a01b038216600090815260016020819052604090912054606091811415611efc5760408051600280825260608201835290916020830190803683370190505091508382600081518110611e9457634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508282600181518110611ed657634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050506116c0565b806002141561202e576040805160038082526080820190925290602082016060803683370190505091508382600081518110611f4857634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505060016000856001600160a01b03166001600160a01b03168152602001908152602001600020600181548110611fad57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b031682600181518110611fec57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508282600281518110611ed657634e487b7160e01b600052603260045260246000fd5b80600314156121eb57604080516003808252608082019092529060208201606080368337019050509150838260008151811061207a57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505060016000856001600160a01b03166001600160a01b031681526020019081526020016000206001815481106120df57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260018151811061211e57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526001909152604090208054600290811061216a57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826002815181106121a957634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508282600381518110611ed657634e487b7160e01b600052603260045260246000fd5b60408051600480825260a082019092529060208201608080368337019050509150838260008151811061222e57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505060016000856001600160a01b03166001600160a01b0316815260200190815260200160002060018154811061229357634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826001815181106122d257634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526001909152604090208054600290811061231e57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260028151811061235d57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092018101919091529085166000908152600190915260409020805460039081106123a957634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826003815181106123e857634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508282600481518110611ed657634e487b7160e01b600052603260045260246000fd5b6040516001600160a01b03808516602483015283166044820152606481018290526109449085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612799565b80158061251e5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b1580156124e457600080fd5b505afa1580156124f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061251c9190612f8c565b155b6125895760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016105e9565b6040516001600160a01b03831660248201526044810182905261189a90849063095ea7b360e01b9060640161245e565b6060806125c68585611e2c565b80519092506125dd6006546001600160a01b031690565b6001600160a01b031663d06ca61f85856040518363ffffffff1660e01b815260040161260a92919061320e565b60006040518083038186803b15801561262257600080fd5b505afa158015612636573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261265e9190810190612e54565b9150815181146126805760405162461bcd60e51b81526004016105e9906131a0565b816000815181106126a157634e487b7160e01b600052603260045260246000fd5b6020026020010151841461167d5760405162461bcd60e51b8152602060048201526015602482015274092dce0eae840c2dadeeadce840dad2e6dac2e8c6d605b1b60448201526064016105e9565b6000546001600160a01b031633146111395760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105e9565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006127ee826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661286b9092919063ffffffff16565b80519091501561189a578080602001905181019061280c9190612e87565b61189a5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016105e9565b606061287a8484600085612882565b949350505050565b6060824710156128e35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016105e9565b600080866001600160a01b031685876040516128ff9190613037565b60006040518083038185875af1925050503d806000811461293c576040519150601f19603f3d011682016040523d82523d6000602084013e612941565b606091505b50915091506129528783838761295d565b979650505050505050565b606083156129c95782516129c2576001600160a01b0385163b6129c25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105e9565b508161287a565b61287a83838151156129de5781518083602001fd5b8060405162461bcd60e51b81526004016105e99190613107565b508054600082559060005260206000209081019061164f9190612aef565b828054828255906000526020600020908101928215612a6b579160200282015b82811115612a6b57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190612a36565b50612a77929150612aef565b5090565b828054612a87906132fb565b90600052602060002090601f016020900481019282612aa95760008555612a6b565b82601f10612ac257805160ff1916838001178555612a6b565b82800160010185558215612a6b579182015b82811115612a6b578251825591602001919060010190612ad4565b5b80821115612a775760008155600101612af0565b600082601f830112612b14578081fd5b81356020612b29612b2483613294565b613263565b80838252828201915082860187848660051b8901011115612b48578586fd5b855b85811015612b6f578135612b5d8161337d565b84529284019290840190600101612b4a565b5090979650505050505050565b600082601f830112612b8c578081fd5b81516020612b9c612b2483613294565b80838252828201915082860187848660051b8901011115612bbb578586fd5b855b85811015612b6f57815184529284019290840190600101612bbd565b600082601f830112612be9578081fd5b813567ffffffffffffffff811115612c0357612c03613367565b612c16601f8201601f1916602001613263565b818152846020838601011115612c2a578283fd5b816020850160208301379081016020019190915292915050565b600060208284031215612c55578081fd5b8135612c608161337d565b9392505050565b600080600060608486031215612c7b578182fd5b8335612c868161337d565b92506020840135612c968161337d565b929592945050506040919091013590565b60008060408385031215612cb9578182fd5b8235612cc48161337d565b946020939093013593505050565b60008060408385031215612ce4578182fd5b823567ffffffffffffffff80821115612cfb578384fd5b612d0786838701612b04565b9350602091508185013581811115612d1d578384fd5b85019050601f81018613612d2f578283fd5b8035612d3d612b2482613294565b80828252848201915084840189868560051b8701011115612d5c578687fd5b8694505b83851015612d7e578035835260019490940193918501918501612d60565b5080955050505050509250929050565b60008060408385031215612da0578182fd5b825167ffffffffffffffff80821115612db7578384fd5b818501915085601f830112612dca578384fd5b81516020612dda612b2483613294565b8083825282820191508286018a848660051b8901011115612df9578889fd5b8896505b84871015612e24578051612e108161337d565b835260019690960195918301918301612dfd565b5091880151919650909350505080821115612e3d578283fd5b50612e4a85828601612b7c565b9150509250929050565b600060208284031215612e65578081fd5b815167ffffffffffffffff811115612e7b578182fd5b61287a84828501612b7c565b600060208284031215612e98578081fd5b81518015158114612c60578182fd5b600060208284031215612eb8578081fd5b813567ffffffffffffffff811115612ece578182fd5b61287a84828501612bd9565b60008060408385031215612eec578182fd5b823567ffffffffffffffff80821115612f03578384fd5b612f0f86838701612bd9565b93506020850135915080821115612f24578283fd5b50612e4a85828601612b04565b60008060408385031215612f43578182fd5b823567ffffffffffffffff811115612f59578283fd5b612f6585828601612bd9565b95602094909401359450505050565b600060208284031215612f85578081fd5b5035919050565b600060208284031215612f9d578081fd5b5051919050565b60008060408385031215612fb6578182fd5b50508035926020909101359150565b6000815180845260208085019450808401835b83811015612ffd5781516001600160a01b031687529582019590820190600101612fd8565b509495945050505050565b6000815180845260208085019450808401835b83811015612ffd5781518752958201959082019060010161301b565b600082516130498184602087016132cf565b9190910192915050565b6001600160a01b0385811682528416602082015260806040820181905260009061307f90830185612fc5565b82810360608401526129528185613008565b602081526000612c606020830184612fc5565b6040815260006130b76040830185612fc5565b82810360208401526130c98185613008565b95945050505050565b8481526080602082015260006130eb6080830186612fc5565b6001600160a01b03949094166040830152506060015292915050565b60208152600082518060208401526131268160408501602087016132cf565b601f01601f19169190910160400192915050565b60208082526017908201527f5061746820646f65736e2774207965742065786973742e000000000000000000604082015260600190565b6020808252601590820152742a37b5b2b7103737ba103932b232b2b6b0b136329760591b604082015260600190565b6020808252600e908201526d105c9c985e5cc81d5b995c5d585b60921b604082015260600190565b60208082526026908201527f5468652066756e6374696f6e206973206e6f7420617661696c61626c65206f6e6040820152651021b2b6379760d11b606082015260800190565b82815260406020820152600061287a6040830184612fc5565b85815284602082015260a06040820152600061324660a0830186612fc5565b6001600160a01b0394909416606083015250608001529392505050565b604051601f8201601f1916810167ffffffffffffffff8111828210171561328c5761328c613367565b604052919050565b600067ffffffffffffffff8211156132ae576132ae613367565b5060051b60200190565b6000828210156132ca576132ca613351565b500390565b60005b838110156132ea5781810151838201526020016132d2565b838111156109445750506000910152565b600181811c9082168061330f57607f821691505b6020821081141561333057634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561334a5761334a613351565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461164f57600080fdfea2646970667358221220ddc1eff4a35a6fbb1eda6b442a738a64ebb110c6ec2e6fa36a3949ae7d1985ea64736f6c63430008040033", + "deployedBytecode": "0x6080604052600436106101d15760003560e01c80638da5cb5b116100f7578063c0681c3d11610095578063e7f67fb111610064578063e7f67fb11461054e578063f04ad9d71461056e578063f2fde38b14610581578063feb21b9c146105a157600080fd5b8063c0681c3d146104db578063c6c53efb146104fb578063d08ec4751461051b578063d8a90c401461053b57600080fd5b8063a0cd6049116100d1578063a0cd60491461044b578063a2844a861461046b578063b4e76a861461049b578063b8baf9db146104bb57600080fd5b80638da5cb5b146103ed5780639753209d1461040b578063a09457221461042b57600080fd5b80635367cd9c1161016f578063715018a61161013e578063715018a61461037857806373200b111461038d57806382155e7e146103ad5780638474c288146103cd57600080fd5b80635367cd9c146102eb57806356a7de0d146102fe57806368d306d91461031e5780636d4565041461034b57600080fd5b80631a0fdecc116101ab5780631a0fdecc1461026a5780632e98c8141461028a57806335bab7e5146102ab5780634865b2b4146102cb57600080fd5b80631109ec99146101dd5780631357b113146102105780631661f8181461024857600080fd5b366101d857005b600080fd5b3480156101e957600080fd5b506101fd6101f8366004612ca7565b6105c1565b6040519081526020015b60405180910390f35b34801561021c57600080fd5b5061023061022b366004612ca7565b610695565b6040516001600160a01b039091168152602001610207565b34801561025457600080fd5b50610268610263366004612cd2565b6106cd565b005b34801561027657600080fd5b506101fd610285366004612c67565b61094a565b61029d610298366004612ca7565b6109dd565b6040516102079291906130a4565b3480156102b757600080fd5b506101fd6102c6366004612c67565b610a3a565b3480156102d757600080fd5b506101fd6102e6366004612c67565b610ba8565b6102686102f9366004612ca7565b610c33565b34801561030a57600080fd5b50610268610319366004612c44565b610eb9565b34801561032a57600080fd5b5061033e610339366004612c44565b611005565b6040516102079190613091565b34801561035757600080fd5b5061036b610366366004612f74565b61107b565b6040516102079190613107565b34801561038457600080fd5b50610268611127565b34801561039957600080fd5b506102306103a8366004612f31565b61113b565b3480156103b957600080fd5b5061029d6103c8366004612ca7565b611166565b3480156103d957600080fd5b506102686103e8366004612c67565b611322565b3480156103f957600080fd5b506000546001600160a01b0316610230565b34801561041757600080fd5b50610268610426366004612ea7565b6115ae565b34801561043757600080fd5b5061029d610446366004612c67565b611652565b34801561045757600080fd5b5061029d610466366004612c67565b611686565b34801561047757600080fd5b5061048b610486366004612c44565b6116b5565b6040519015158152602001610207565b3480156104a757600080fd5b506101fd6104b6366004612ca7565b6116c6565b3480156104c757600080fd5b506102686104d6366004612eda565b6117ba565b3480156104e757600080fd5b506102686104f6366004612c44565b61189f565b34801561050757600080fd5b50610230610516366004612fa4565b6118f9565b34801561052757600080fd5b5061029d610536366004612ca7565b611921565b6101fd610549366004612c44565b611939565b34801561055a57600080fd5b50600654610230906001600160a01b031681565b61029d61057c366004612c44565b611adc565b34801561058d57600080fd5b5061026861059c366004612c44565b611b3b565b3480156105ad57600080fd5b506102306105bc366004612f74565b611bb1565b6000826105cd81611bdb565b6105f25760405162461bcd60e51b81526004016105e990613171565b60405180910390fd5b6000600260405161060f9065574d4154494360d01b815260060190565b908152602001604051809103902060008154811061063d57634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b0316915061065e828787611c53565b9150508060008151811061068257634e487b7160e01b600052603260045260246000fd5b6020026020010151935050505092915050565b600160205281600052604060002081815481106106b157600080fd5b6000918252602090912001546001600160a01b03169150829050565b81518061070a5760405162461bcd60e51b815260206004820152600b60248201526a417272617920656d70747960a81b60448201526064016105e9565b8151811461072a5760405162461bcd60e51b81526004016105e9906131a0565b60005b818110156109445782818151811061075557634e487b7160e01b600052603260045260246000fd5b60200260200101516000141561076a57610932565b82818151811061078a57634e487b7160e01b600052603260045260246000fd5b60200260200101518482815181106107b257634e487b7160e01b600052603260045260246000fd5b60209081029190910101516040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b1580156107fd57600080fd5b505afa158015610811573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108359190612f8c565b10156108835760405162461bcd60e51b815260206004820152601960248201527f496e73756666696369656e742054434f322062616c616e63650000000000000060448201526064016105e9565b8381815181106108a357634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316633790cf578483815181106108d957634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b81526004016108ff91815260200190565b600060405180830381600087803b15801561091957600080fd5b505af115801561092d573d6000803e3d6000fd5b505050505b8061093c81613336565b91505061072d565b50505050565b60008361095681611d93565b6109725760405162461bcd60e51b81526004016105e99061313a565b8361097c81611bdb565b6109985760405162461bcd60e51b81526004016105e990613171565b60006109a5878787611c53565b915050806000815181106109c957634e487b7160e01b600052603260045260246000fd5b602002602001015193505050509392505050565b60608061a4ec46141580156109f4575061aef34614155b610a105760405162461bcd60e51b81526004016105e9906131c8565b610a1a8484610c33565b610a248484611166565b9092509050610a3382826106cd565b9250929050565b600083610a4681611d93565b610a625760405162461bcd60e51b81526004016105e99061313a565b83610a6c81611bdb565b610a885760405162461bcd60e51b81526004016105e990613171565b6000610a948787611e2c565b8051909150610aae6001600160a01b03891633308961242a565b600654610ac8906001600160a01b038a8116911688612495565b6000610adc6006546001600160a01b031690565b6001600160a01b03166338ed17398860008630426040518663ffffffff1660e01b8152600401610b10959493929190613227565b600060405180830381600087803b158015610b2a57600080fd5b505af1158015610b3e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b669190810190612e54565b905080610b746001846132b8565b81518110610b9257634e487b7160e01b600052603260045260246000fd5b6020026020010151955050505050509392505050565b600083610bb481611d93565b610bd05760405162461bcd60e51b81526004016105e99061313a565b83610bda81611bdb565b610bf65760405162461bcd60e51b81526004016105e990613171565b6000610c038787876125b9565b9150508060018251610c1591906132b8565b815181106109c957634e487b7160e01b600052603260045260246000fd5b61a4ec4614158015610c47575061aef34614155b610c635760405162461bcd60e51b81526004016105e9906131c8565b81610c6d81611bdb565b610c895760405162461bcd60e51b81526004016105e990613171565b60006002604051610ca69065574d4154494360d01b815260060190565b9081526020016040518091039020600081548110610cd457634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b03169150610cf48286611e2c565b90506000610d0a6006546001600160a01b031690565b6001600160a01b031663fb3bdb4134878530426040518663ffffffff1660e01b8152600401610d3c94939291906130d2565b6000604051808303818588803b158015610d5557600080fd5b505af1158015610d69573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052610d929190810190612e54565b905080600081518110610db557634e487b7160e01b600052603260045260246000fd5b6020026020010151341115610eb157600081600081518110610de757634e487b7160e01b600052603260045260246000fd5b602002602001015134610dfa91906132b8565b604080516000808252602082019283905292935033918491610e1b91613037565b60006040518083038185875af1925050503d8060008114610e58576040519150601f19603f3d011682016040523d82523d6000602084013e610e5d565b606091505b5050905080610eae5760405162461bcd60e51b815260206004820152601b60248201527f4661696c656420746f2073656e6420737572706c7573206261636b000000000060448201526064016105e9565b50505b505050505050565b610ec16126ef565b60005b60035481101561100157816001600160a01b031660038281548110610ef957634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415610fef5760038054610f24906001906132b8565b81548110610f4257634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600380546001600160a01b039092169183908110610f7c57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506003805480610fc957634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b03191690550190555050565b80610ff981613336565b915050610ec4565b5050565b6001600160a01b03811660009081526001602090815260409182902080548351818402810184019094528084526060939283018282801561106f57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611051575b50505050509050919050565b6004818154811061108b57600080fd5b9060005260206000200160009150905080546110a6906132fb565b80601f01602080910402602001604051908101604052809291908181526020018280546110d2906132fb565b801561111f5780601f106110f45761010080835404028352916020019161111f565b820191906000526020600020905b81548152906001019060200180831161110257829003601f168201915b505050505081565b61112f6126ef565b6111396000612749565b565b815160208184018101805160028252928201918501919091209190528054829081106106b157600080fd5b6060808361117381611bdb565b61118f5760405162461bcd60e51b81526004016105e990613171565b6040516370a0823160e01b815230600482015284906001600160a01b038716906370a082319060240160206040518083038186803b1580156111d057600080fd5b505afa1580156111e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112089190612f8c565b10156112565760405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e74204e43542f4243542062616c616e63650000000060448201526064016105e9565b604051634c02cad160e01b81526004810185905285906001600160a01b03821690634c02cad190602401600060405180830381600087803b15801561129a57600080fd5b505af11580156112ae573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526112d69190810190612d8e565b60405191955093507f3d29f82a20ec733db9f357c4dc1ae0ee60c572cc4b877384aa4639e4d877b18890611311903390899088908890613053565b60405180910390a150509250929050565b8261132c81611d93565b6113485760405162461bcd60e51b81526004016105e99061313a565b8261135281611bdb565b61136e5760405162461bcd60e51b81526004016105e990613171565b60008061137c878787611c53565b915091506000816000815181106113a357634e487b7160e01b600052603260045260246000fd5b602090810291909101015190506113c56001600160a01b03891633308461242a565b60065460405163095ea7b360e01b81526001600160a01b039182166004820152602481018390529089169063095ea7b390604401602060405180830381600087803b15801561141357600080fd5b505af1158015611427573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144b9190612e87565b5060006114606006546001600160a01b031690565b6001600160a01b0316638803dbee88848730426040518663ffffffff1660e01b8152600401611493959493929190613227565b600060405180830381600087803b1580156114ad57600080fd5b505af11580156114c1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526114e99190810190612e54565b9050818160008151811061150d57634e487b7160e01b600052603260045260246000fd5b602002602001015110156115a35760065460405163095ea7b360e01b81526001600160a01b03918216600482015260006024820152908a169063095ea7b390604401602060405180830381600087803b15801561156957600080fd5b505af115801561157d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a19190612e87565b505b505050505050505050565b6115b66126ef565b600160006002836040516115ca9190613037565b90815260200160405180910390206000815481106115f857634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528201929092526040018120611625916129f8565b6002816040516116359190613037565b9081526020016040518091039020600061164f91906129f8565b50565b6060806000611662868686610a3a565b905061166e8582611166565b909350915061167d83836106cd565b50935093915050565b606080611694858585611322565b61169e8484611166565b90925090506116ad82826106cd565b935093915050565b60006116c082611bdb565b92915050565b600061a4ec46141580156116dc575061aef34614155b6116f85760405162461bcd60e51b81526004016105e9906131c8565b8261170281611bdb565b61171e5760405162461bcd60e51b81526004016105e990613171565b6000600260405161173b9065574d4154494360d01b815260060190565b908152602001604051809103902060008154811061176957634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b0316915061178a8287876125b9565b915050806001825161179c91906132b8565b8151811061068257634e487b7160e01b600052603260045260246000fd5b6117c26126ef565b8060016000836000815181106117e857634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000209080519060200190611823929190612a16565b50806002836040516118359190613037565b90815260200160405180910390209080519060200190611856929190612a16565b5060048054600181018255600091909152825161189a917f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b01906020850190612a7b565b505050565b6118a76126ef565b600380546001810182556000919091527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b0319166001600160a01b0392909216919091179055565b6005828154811061190957600080fd5b9060005260206000200181815481106106b157600080fd5b606080610a1a6001600160a01b03851633308661242a565b600061a4ec461415801561194f575061aef34614155b61196b5760405162461bcd60e51b81526004016105e9906131c8565b8161197581611bdb565b6119915760405162461bcd60e51b81526004016105e990613171565b60405165574d4154494360d01b8152349060009060029060060190815260200160405180910390206000815481106119d957634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b031691506119f98287611e2c565b80519091506000611a126006546001600160a01b031690565b6001600160a01b0316637ff36ab58660008630426040518663ffffffff1660e01b8152600401611a4594939291906130d2565b6000604051808303818588803b158015611a5e57600080fd5b505af1158015611a72573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052611a9b9190810190612e54565b905080611aa96001846132b8565b81518110611ac757634e487b7160e01b600052603260045260246000fd5b60200260200101519650505050505050919050565b60608061a4ec4614158015611af3575061aef34614155b611b0f5760405162461bcd60e51b81526004016105e9906131c8565b6000611b1a84611939565b9050611b268482611166565b9093509150611b3583836106cd565b50915091565b611b436126ef565b6001600160a01b038116611ba85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105e9565b61164f81612749565b60038181548110611bc157600080fd5b6000918252602090912001546001600160a01b0316905081565b6000805b600354811015611c4a57826001600160a01b031660038281548110611c1457634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415611c385750600192915050565b80611c4281613336565b915050611bdf565b50600092915050565b606080611c608585611e2c565b8051909250611c776006546001600160a01b031690565b6001600160a01b0316631f00ca7485856040518363ffffffff1660e01b8152600401611ca492919061320e565b60006040518083038186803b158015611cbc57600080fd5b505afa158015611cd0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611cf89190810190612e54565b915081518114611d1a5760405162461bcd60e51b81526004016105e9906131a0565b81611d266001836132b8565b81518110611d4457634e487b7160e01b600052603260045260246000fd5b6020026020010151841461167d5760405162461bcd60e51b815260206004820152601660248201527509eeae8e0eae840c2dadeeadce840dad2e6dac2e8c6d60531b60448201526064016105e9565b6000805b600554811015611c4a57826001600160a01b031660058281548110611dcc57634e487b7160e01b600052603260045260246000fd5b90600052602060002001600081548110611df657634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415611e1a5750600192915050565b80611e2481613336565b915050611d97565b6001600160a01b038216600090815260016020819052604090912054606091811415611efc5760408051600280825260608201835290916020830190803683370190505091508382600081518110611e9457634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508282600181518110611ed657634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050506116c0565b806002141561202e576040805160038082526080820190925290602082016060803683370190505091508382600081518110611f4857634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505060016000856001600160a01b03166001600160a01b03168152602001908152602001600020600181548110611fad57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b031682600181518110611fec57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508282600281518110611ed657634e487b7160e01b600052603260045260246000fd5b80600314156121eb57604080516003808252608082019092529060208201606080368337019050509150838260008151811061207a57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505060016000856001600160a01b03166001600160a01b031681526020019081526020016000206001815481106120df57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260018151811061211e57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526001909152604090208054600290811061216a57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826002815181106121a957634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508282600381518110611ed657634e487b7160e01b600052603260045260246000fd5b60408051600480825260a082019092529060208201608080368337019050509150838260008151811061222e57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505060016000856001600160a01b03166001600160a01b0316815260200190815260200160002060018154811061229357634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826001815181106122d257634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526001909152604090208054600290811061231e57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260028151811061235d57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092018101919091529085166000908152600190915260409020805460039081106123a957634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826003815181106123e857634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508282600481518110611ed657634e487b7160e01b600052603260045260246000fd5b6040516001600160a01b03808516602483015283166044820152606481018290526109449085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612799565b80158061251e5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b1580156124e457600080fd5b505afa1580156124f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061251c9190612f8c565b155b6125895760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016105e9565b6040516001600160a01b03831660248201526044810182905261189a90849063095ea7b360e01b9060640161245e565b6060806125c68585611e2c565b80519092506125dd6006546001600160a01b031690565b6001600160a01b031663d06ca61f85856040518363ffffffff1660e01b815260040161260a92919061320e565b60006040518083038186803b15801561262257600080fd5b505afa158015612636573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261265e9190810190612e54565b9150815181146126805760405162461bcd60e51b81526004016105e9906131a0565b816000815181106126a157634e487b7160e01b600052603260045260246000fd5b6020026020010151841461167d5760405162461bcd60e51b8152602060048201526015602482015274092dce0eae840c2dadeeadce840dad2e6dac2e8c6d605b1b60448201526064016105e9565b6000546001600160a01b031633146111395760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105e9565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006127ee826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661286b9092919063ffffffff16565b80519091501561189a578080602001905181019061280c9190612e87565b61189a5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016105e9565b606061287a8484600085612882565b949350505050565b6060824710156128e35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016105e9565b600080866001600160a01b031685876040516128ff9190613037565b60006040518083038185875af1925050503d806000811461293c576040519150601f19603f3d011682016040523d82523d6000602084013e612941565b606091505b50915091506129528783838761295d565b979650505050505050565b606083156129c95782516129c2576001600160a01b0385163b6129c25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105e9565b508161287a565b61287a83838151156129de5781518083602001fd5b8060405162461bcd60e51b81526004016105e99190613107565b508054600082559060005260206000209081019061164f9190612aef565b828054828255906000526020600020908101928215612a6b579160200282015b82811115612a6b57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190612a36565b50612a77929150612aef565b5090565b828054612a87906132fb565b90600052602060002090601f016020900481019282612aa95760008555612a6b565b82601f10612ac257805160ff1916838001178555612a6b565b82800160010185558215612a6b579182015b82811115612a6b578251825591602001919060010190612ad4565b5b80821115612a775760008155600101612af0565b600082601f830112612b14578081fd5b81356020612b29612b2483613294565b613263565b80838252828201915082860187848660051b8901011115612b48578586fd5b855b85811015612b6f578135612b5d8161337d565b84529284019290840190600101612b4a565b5090979650505050505050565b600082601f830112612b8c578081fd5b81516020612b9c612b2483613294565b80838252828201915082860187848660051b8901011115612bbb578586fd5b855b85811015612b6f57815184529284019290840190600101612bbd565b600082601f830112612be9578081fd5b813567ffffffffffffffff811115612c0357612c03613367565b612c16601f8201601f1916602001613263565b818152846020838601011115612c2a578283fd5b816020850160208301379081016020019190915292915050565b600060208284031215612c55578081fd5b8135612c608161337d565b9392505050565b600080600060608486031215612c7b578182fd5b8335612c868161337d565b92506020840135612c968161337d565b929592945050506040919091013590565b60008060408385031215612cb9578182fd5b8235612cc48161337d565b946020939093013593505050565b60008060408385031215612ce4578182fd5b823567ffffffffffffffff80821115612cfb578384fd5b612d0786838701612b04565b9350602091508185013581811115612d1d578384fd5b85019050601f81018613612d2f578283fd5b8035612d3d612b2482613294565b80828252848201915084840189868560051b8701011115612d5c578687fd5b8694505b83851015612d7e578035835260019490940193918501918501612d60565b5080955050505050509250929050565b60008060408385031215612da0578182fd5b825167ffffffffffffffff80821115612db7578384fd5b818501915085601f830112612dca578384fd5b81516020612dda612b2483613294565b8083825282820191508286018a848660051b8901011115612df9578889fd5b8896505b84871015612e24578051612e108161337d565b835260019690960195918301918301612dfd565b5091880151919650909350505080821115612e3d578283fd5b50612e4a85828601612b7c565b9150509250929050565b600060208284031215612e65578081fd5b815167ffffffffffffffff811115612e7b578182fd5b61287a84828501612b7c565b600060208284031215612e98578081fd5b81518015158114612c60578182fd5b600060208284031215612eb8578081fd5b813567ffffffffffffffff811115612ece578182fd5b61287a84828501612bd9565b60008060408385031215612eec578182fd5b823567ffffffffffffffff80821115612f03578384fd5b612f0f86838701612bd9565b93506020850135915080821115612f24578283fd5b50612e4a85828601612b04565b60008060408385031215612f43578182fd5b823567ffffffffffffffff811115612f59578283fd5b612f6585828601612bd9565b95602094909401359450505050565b600060208284031215612f85578081fd5b5035919050565b600060208284031215612f9d578081fd5b5051919050565b60008060408385031215612fb6578182fd5b50508035926020909101359150565b6000815180845260208085019450808401835b83811015612ffd5781516001600160a01b031687529582019590820190600101612fd8565b509495945050505050565b6000815180845260208085019450808401835b83811015612ffd5781518752958201959082019060010161301b565b600082516130498184602087016132cf565b9190910192915050565b6001600160a01b0385811682528416602082015260806040820181905260009061307f90830185612fc5565b82810360608401526129528185613008565b602081526000612c606020830184612fc5565b6040815260006130b76040830185612fc5565b82810360208401526130c98185613008565b95945050505050565b8481526080602082015260006130eb6080830186612fc5565b6001600160a01b03949094166040830152506060015292915050565b60208152600082518060208401526131268160408501602087016132cf565b601f01601f19169190910160400192915050565b60208082526017908201527f5061746820646f65736e2774207965742065786973742e000000000000000000604082015260600190565b6020808252601590820152742a37b5b2b7103737ba103932b232b2b6b0b136329760591b604082015260600190565b6020808252600e908201526d105c9c985e5cc81d5b995c5d585b60921b604082015260600190565b60208082526026908201527f5468652066756e6374696f6e206973206e6f7420617661696c61626c65206f6e6040820152651021b2b6379760d11b606082015260800190565b82815260406020820152600061287a6040830184612fc5565b85815284602082015260a06040820152600061324660a0830186612fc5565b6001600160a01b0394909416606083015250608001529392505050565b604051601f8201601f1916810167ffffffffffffffff8111828210171561328c5761328c613367565b604052919050565b600067ffffffffffffffff8211156132ae576132ae613367565b5060051b60200190565b6000828210156132ca576132ca613351565b500390565b60005b838110156132ea5781810151838201526020016132d2565b838111156109445750506000910152565b600181811c9082168061330f57607f821691505b6020821081141561333057634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561334a5761334a613351565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461164f57600080fdfea2646970667358221220ddc1eff4a35a6fbb1eda6b442a738a64ebb110c6ec2e6fa36a3949ae7d1985ea64736f6c63430008040033", "devdoc": { "events": { "Redeemed(address,address,address[],uint256[])": { "params": { "amounts": "An array of the amounts of each TCO2 that were redeemed", - "poolToken": "The address of the Toucan pool token used in the redemption, e.g., NCT", + "poolToken": "The address of the pool token used in the redemption, e.g., NCT", "sender": "The sender of the transaction", "tco2s": "An array of the TCO2 addresses that were redeemed" } @@ -883,7 +814,7 @@ "autoOffsetExactInETH(address)": { "details": "This function is only available on Polygon, not on Celo.", "params": { - "_poolToken": "The address of the pool token to offset, e.g., NCT" + "_poolToken": "The address of the pool token to swap for, e.g., NCT" }, "returns": { "amounts": "An array of the amounts of each TCO2 that were redeemed", @@ -891,11 +822,11 @@ } }, "autoOffsetExactInToken(address,address,uint256)": { - "details": "When automatically redeeming pool tokens for the lowest quality TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool token.", + "details": "When automatically redeeming pool tokens for the oldest ones TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool token.", "params": { "_amountToSwap": "The amount of ERC20 token to swap into Toucan pool token. Full amount will be used for offsetting.", "_fromToken": "The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)", - "_poolToken": "The address of the pool token to offset, e.g., NCT" + "_poolToken": "The address of the pool token that the user wants to use, e.g., NCT" }, "returns": { "amounts": "An array of the amounts of each TCO2 that were redeemed", @@ -906,7 +837,7 @@ "details": "If the user sends too much native tokens , the leftover amount will be sent back to the user. This function is only available on Polygon, not on Celo.", "params": { "_amountToOffset": "The amount of TCO2 to offset.", - "_poolToken": "The address of the pool token to offset, e.g., NCT" + "_poolToken": "The address of the pool token to swap for, e.g., NCT" }, "returns": { "amounts": "An array of the amounts of each TCO2 that were redeemed", @@ -914,11 +845,11 @@ } }, "autoOffsetExactOutToken(address,address,uint256)": { - "details": "When automatically redeeming pool tokens for the lowest quality TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool token.", + "details": "When automatically redeeming pool tokens for the oldest ones TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool token.", "params": { "_amountToOffset": "The amount of TCO2 to offset", "_fromToken": "The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)", - "_poolToken": "The address of the Toucan pool token that the user wants to offset, e.g., NCT" + "_poolToken": "The address of the pool token that the user wants to use, e.g., NCT" }, "returns": { "amounts": "An array of the amounts of each TCO2 that were redeemed", @@ -928,7 +859,7 @@ "autoOffsetPoolToken(address,uint256)": { "params": { "_amountToOffset": "The amount of TCO2 to offset.", - "_poolToken": "The address of the pool token to offset, e.g., NCT" + "_poolToken": "The address of the pool token to swap for, e.g., NCT" }, "returns": { "amounts": "An array of the amounts of each TCO2 that were redeemed", @@ -973,7 +904,7 @@ }, "calculateNeededETHAmount(address,uint256)": { "params": { - "_poolToken": "The address of the pool token to swap for, e.g., NCT", + "_poolToken": "The address of the pool token to swap for, for example, NCT", "_toAmount": "The desired amount of pool token to receive" }, "returns": { @@ -998,9 +929,6 @@ "_tokenSymbolsForPaths": "An array of symbols of the token the user want to retire carbon credits for" } }, - "deposit(address,uint256)": { - "details": "Needs to be approved" - }, "isERC20AddressEligible(address)": { "params": { "_erc20Address": "The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)" @@ -1011,10 +939,10 @@ }, "isPoolAddressEligible(address)": { "params": { - "_poolToken": "The address of the pool token to offset, e.g., NCT" + "_poolToken": "The addresses of the pool token to redeem" }, "returns": { - "_isEligible": "Returns a bool if the Pool token is eligible for offsetting" + "_isEligible": "Returns if token can be redeemed" } }, "owner()": { @@ -1038,24 +966,24 @@ "_poolToken": "The address of the pool token to swap for, e.g., NCT" }, "returns": { - "amountOut": "Resulting amount of Toucan pool token that got acquired for the swapped native tokens ." + "amountOut": "Resulting amount of pool token that got acquired for the swapped native tokens ." } }, "swapExactInToken(address,address,uint256)": { "details": "Needs to be approved on the client side.", "params": { - "_fromAmount": "The amount of ERC20 token to swap", + "_fromAmount": "The amount of ERC20 token to swap e.g., NCT", "_fromToken": "The address of the ERC20 token used for the swap", - "_poolToken": "The address of the pool token to swap for, e.g., NCT" + "_poolToken": "The address of the pool token to swap for," }, "returns": { - "amountOut": "Resulting amount of Toucan pool token that got acquired for the swapped ERC20 tokens." + "amountOut": "Resulting amount of pool token that got acquired for the swapped ERC20 tokens." } }, "swapExactOutETH(address,uint256)": { "params": { "_poolToken": "The address of the pool token to swap for, e.g., NCT", - "_toAmount": "The required amount of the Toucan pool token (NCT/BCT)" + "_toAmount": "The required amount of the pool token (NCT/BCT)" } }, "swapExactOutToken(address,address,uint256)": { @@ -1063,7 +991,7 @@ "params": { "_fromToken": "The address of the ERC20 token used for the swap", "_poolToken": "The address of the pool token to swap for, e.g., NCT", - "_toAmount": "The required amount of the Toucan pool token (NCT/BCT)" + "_toAmount": "The required amount of the pool token (NCT/BCT)" } }, "transferOwnership(address)": { @@ -1088,19 +1016,19 @@ "notice": "Change or add pool token addresses." }, "autoOffsetExactInETH(address)": { - "notice": "Retire carbon credits using the lowest quality (oldest) TCO2 tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC. All provided native tokens is consumed for offsetting. The `view` helper function `calculateExpectedPoolTokenForETH()` can be used to calculate the expected amount of TCO2s that will be offset using `autoOffsetExactInETH()`. This function: 1. Swaps the native token e.g. MATIC sent to the contract for the specified pool token. 2. Redeems the pool token for the poorest quality TCO2 tokens available. 3. Retires the TCO2 tokens." + "notice": "Retire carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC. All provided native tokens is consumed for offsetting. Use `calculateExpectedPoolTokenForETH()` to calculate the expected amount of Pool token that can be acquired by swapping the provided amount of native tokens e.g., MATIC. This function: 1. Swaps the Matic sent to the contract for the specified pool token. 2. Redeems the pool token for the oldest TCO2 tokens available. 3. Retires the TCO2 tokens." }, "autoOffsetExactInToken(address,address,uint256)": { - "notice": "Retire carbon credits using the lowest quality (oldest) TCO2 tokens available from the specified Toucan token pool by sending ERC20 tokens (cUSD, USDC, WETH, WMATIC). All provided token is consumed for offsetting. The `view` helper function `calculateExpectedPoolTokenForToken()` can be used to calculate the expected amount of TCO2s that will be offset using `autoOffsetExactInToken()`. This function: 1. Swaps the ERC20 token sent to the contract for the specified pool token. 2. Redeems the pool token for the poorest quality TCO2 tokens available. 3. Retires the TCO2 tokens. Note: The client must approve the ERC20 token that is sent to the contract." + "notice": "Retire carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending ERC20 tokens (cUSD, USDC, WETH, WMATIC). All provided token is consumed for offsetting. Use `calculateExpectedPoolTokenForToken()` to calculate the expected amount of Pool token that can be acquired by swapping the provided amount of ERC20 token. This function: 1. Swaps the ERC20 token sent to the contract for the specified pool token. 2. Redeems the pool token for the oldest TCO2 tokens available. 3. Retires the TCO2 tokens. Note: The client must approve the ERC20 token that is sent to the contract." }, "autoOffsetExactOutETH(address,uint256)": { - "notice": "Retire carbon credits using the lowest quality (oldest) TCO2 tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC. The `view` helper function `calculateNeededETHAmount()` should be called before using `autoOffsetExactOutETH()`, to determine how much native tokens e.g., MATIC must be sent to the `OffsetHelper` contract in order to retire the specified amount of carbon. This function: 1. Swaps the native token e.g. MATIC sent to the contract for the specified pool token. 2. Redeems the pool token for the poorest quality TCO2 tokens available. 3. Retires the TCO2 tokens." + "notice": "Retire carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC. Use `calculateNeededETHAmount()` first in order to find out how much native tokens are required to retire the specified quantity of TCO2. This function: 1. Swaps the Matic sent to the contract for the specified pool token. 2. Redeems the pool token for the oldest TCO2 tokens available. 3. Retires the TCO2 tokens." }, "autoOffsetExactOutToken(address,address,uint256)": { - "notice": "Retire carbon credits using the lowest quality (oldest) TCO2 tokens available from the specified Toucan token pool by sending ERC20 tokens (cUSD, USDC, WETH, WMATIC). The `view` helper function `calculateNeededTokenAmount()` should be called before using `autoOffsetExactOutToken()`, to determine how much native tokens e.g., MATIC must be sent to the `OffsetHelper` contract in order to retire the specified amount of carbon. This function: 1. Swaps the ERC20 token sent to the contract for the specified pool token. 2. Redeems the pool token for the poorest quality TCO2 tokens available. 3. Retires the TCO2 tokens. Note: The client must approve the ERC20 token that is sent to the contract." + "notice": "Retire carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending ERC20 tokens (cUSD, USDC, WETH, WMATIC). Use `calculateNeededTokenAmount` first in order to find out how much of the ERC20 token is required to retire the specified quantity of TCO2. This function: 1. Swaps the ERC20 token sent to the contract for the specified pool token. 2. Redeems the pool token for the oldest TCO2 tokens available. 3. Retires the TCO2 tokens. Note: The client must approve the ERC20 token that is sent to the contract." }, "autoOffsetPoolToken(address,uint256)": { - "notice": "Retire carbon credits using the lowest quality (oldest) TCO2 tokens available by sending Toucan pool tokens, e.g., NCT. This function: 1. Redeems the pool token for the poorest quality TCO2 tokens available. 2. Retires the TCO2 tokens. Note: The client must approve the pool token that is sent." + "notice": "Retire carbon credits using the oldest TCO2 tokens available by sending pool tokens, e.g., NCT. This function: 1. Redeems the pool token for the oldest TCO2 tokens available. 2. Retires the TCO2 tokens. Note: The client must approve the pool token that is sent." }, "autoRedeem(address,uint256)": { "notice": "Redeems the specified amount of NCT / BCT for TCO2." @@ -1109,28 +1037,25 @@ "notice": "Retire the specified TCO2 tokens." }, "calculateExpectedPoolTokenForETH(address,uint256)": { - "notice": "Calculates the expected amount of Toucan Pool token that can be acquired by swapping the provided amount of native tokens e.g., MATIC." + "notice": "Calculates the expected amount of pool token that can be acquired by swapping the provided amount of native tokens e.g., MATIC." }, "calculateExpectedPoolTokenForToken(address,address,uint256)": { - "notice": "Calculates the expected amount of Toucan Pool token that can be acquired by swapping the provided amount of ERC20 token." + "notice": "Calculates the expected amount of pool token that can be acquired by swapping the provided amount of ERC20 token." }, "calculateNeededETHAmount(address,uint256)": { - "notice": "Return how much native tokens e.g, MATIC is required in order to swap for the desired amount of a Toucan pool token, e.g., NCT." + "notice": "Return how much native tokens e.g, MATIC is required in order to swap for the desired amount of a pool token, e.g., NCT." }, "calculateNeededTokenAmount(address,address,uint256)": { - "notice": "Return how much of the specified ERC20 token is required in order to swap for the desired amount of a Toucan pool token, for example, e.g., NCT." + "notice": "Return how much of the specified ERC20 token is required in order to swap for the desired amount of a pool token, for example, e.g., NCT." }, "constructor": { "notice": "Contract constructor. Should specify arrays of ERC20 symbols and addresses that can used by the contract." }, - "deposit(address,uint256)": { - "notice": "Allow users to deposit BCT / NCT." - }, "isERC20AddressEligible(address)": { - "notice": "Checks if ERC20 Token is eligible for swapping." + "notice": "Checks if ERC20 Token is eligible for Offsetting." }, "isPoolAddressEligible(address)": { - "notice": "Checks if Pool Address is eligible for offsetting." + "notice": "Cheks if Pool Token is eligible for Offsetting." }, "removePath(string)": { "notice": "Delete eligible tokens stored in the contract." @@ -1139,121 +1064,78 @@ "notice": "Delete eligible pool token addresses stored in the contract." }, "swapExactInETH(address)": { - "notice": "Swap native tokens e.g., MATIC for Toucan pool tokens (BCT/NCT) on SushiSwap. All provided native tokens will be swapped." + "notice": "Swap native tokens e.g., MATIC for pool tokens (BCT/NCT) on SushiSwap. All provided native tokens will be swapped." }, "swapExactInToken(address,address,uint256)": { - "notice": "Swap eligible ERC20 tokens for Toucan pool tokens (BCT/NCT) on SushiSwap. All provided ERC20 tokens will be swapped." + "notice": "Swap eligible ERC20 tokens for pool tokens (BCT/NCT) on SushiSwap. All provided ERC20 tokens will be swapped." }, "swapExactOutETH(address,uint256)": { - "notice": "Swap native tokens e.g., MATIC for Toucan pool tokens (BCT/NCT) on SushiSwap. Remaining native tokens that was not consumed by the swap is returned." + "notice": "Swap native tokens e.g., MATIC for pool tokens (BCT/NCT) on SushiSwap. Remaining native tokens that was not consumed by the swap is returned." }, "swapExactOutToken(address,address,uint256)": { - "notice": "Swap eligible ERC20 tokens for Toucan pool tokens (BCT/NCT) on SushiSwap" - }, - "withdraw(address,uint256)": { - "notice": "Allow users to withdraw tokens they have deposited." + "notice": "Swap eligible ERC20 tokens for pool tokens (BCT/NCT) on SushiSwap" } }, - "notice": "Helper functions that simplify the carbon offsetting (retirement) process. Retiring carbon tokens requires multiple steps and interactions with Toucan Protocol's main contracts: 1. Obtain a Toucan pool token e.g., NCT (by performing a token swap on a DEX). 2. Redeem the pool token for a TCO2 token. 3. Retire the TCO2 token. These steps are combined in each of the following \"auto offset\" methods implemented in `OffsetHelper` to allow a retirement within one transaction: - `autoOffsetPoolToken()` if the user already owns a Toucan pool token e.g., NCT, - `autoOffsetExactOutETH()` if the user would like to perform a retirement using native tokens e.g., MATIC, specifying the exact amount of TCO2s to retire (only on Polygon, not on Celo), - `autoOffsetExactInETH()` if the user would like to perform a retirement using native tokens, swapping all sent native tokens into TCO2s (only on Polygon, not on Celo), - `autoOffsetExactOutToken()` if the user would like to perform a retirement using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount of TCO2s to retire, - `autoOffsetExactInToken()` if the user would like to perform a retirement using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount of token to swap into TCO2s. In these methods, \"auto\" refers to the fact that these methods use `autoRedeem()` in order to automatically choose a TCO2 token corresponding to the oldest tokenized carbon project in the specfified token pool. There are no fees incurred by the user when using `autoRedeem()`, i.e., the user receives 1 TCO2 token for each pool token (BCT/NCT) redeemed. There are two `view` helper functions `calculateNeededETHAmount()` and `calculateNeededTokenAmount()` that should be called before using `autoOffsetExactOutETH()` and `autoOffsetExactOutToken()`, to determine how much native tokens e.g., MATIC, respectively how much of the ERC20 token must be sent to the `OffsetHelper` contract in order to retire the specified amount of carbon. The two `view` helper functions `calculateExpectedPoolTokenForETH()` and `calculateExpectedPoolTokenForToken()` can be used to calculate the expected amount of TCO2s that will be offset using functions `autoOffsetExactInETH()` and `autoOffsetExactInToken()`.", + "notice": "Helper functions that simplify the carbon offsetting (retirement) process. Retiring carbon tokens requires multiple steps and interactions with Toucan Protocol's main contracts: 1. Obtain a pool token e.g., NCT (by performing a token swap on a DEX). 2. Redeem the pool token for a TCO2 token. 3. Retire the TCO2 token. These steps are combined in each of the following \"auto offset\" methods implemented in `OffsetHelper` to allow a retirement within one transaction: - `autoOffsetPoolToken()` if the user already owns a Toucan pool token e.g., NCT, - `autoOffsetExactOutETH()` if the user would like to perform a retirement using native tokens e.g., MATIC, specifying the exact amount of TCO2s to retire (only on Polygon, not on Celo), - `autoOffsetExactInETH()` if the user would like to perform a retirement using native tokens, swapping all sent native tokens into TCO2s (only on Polygon, not on Celo), - `autoOffsetExactOutToken()` if the user would like to perform a retirement using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount of TCO2s to retire, - `autoOffsetExactInToken()` if the user would like to perform a retirement using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount of token to swap into TCO2s. In these methods, \"auto\" refers to the fact that these methods use `autoRedeem()` in order to automatically choose a TCO2 token corresponding to the oldest tokenized carbon project in the specfified token pool. There are no fees incurred by the user when using `autoRedeem()`, i.e., the user receives 1 TCO2 token for each pool token (BCT/NCT) redeemed. There are two `view` helper functions `calculateNeededETHAmount()` and `calculateNeededTokenAmount()` that should be called before using `autoOffsetExactOutETH()` and `autoOffsetExactOutToken()`, to determine how much native tokens e.g., MATIC, respectively how much of the ERC20 token must be sent to the `OffsetHelper` contract in order to retire the specified amount of carbon. The two `view` helper functions `calculateExpectedPoolTokenForETH()` and `calculateExpectedPoolTokenForToken()` can be used to calculate the expected amount of TCO2s that will be offset using functions `autoOffsetExactInETH()` and `autoOffsetExactInToken()`.", "version": 1 }, "storageLayout": { "storage": [ { - "astId": 138, - "contract": "contracts/OffsetHelper.sol:OffsetHelper", - "label": "_initialized", - "offset": 0, - "slot": "0", - "type": "t_uint8" - }, - { - "astId": 141, - "contract": "contracts/OffsetHelper.sol:OffsetHelper", - "label": "_initializing", - "offset": 1, - "slot": "0", - "type": "t_bool" - }, - { - "astId": 703, - "contract": "contracts/OffsetHelper.sol:OffsetHelper", - "label": "__gap", - "offset": 0, - "slot": "1", - "type": "t_array(t_uint256)50_storage" - }, - { - "astId": 10, + "astId": 2465, "contract": "contracts/OffsetHelper.sol:OffsetHelper", "label": "_owner", "offset": 0, - "slot": "51", + "slot": "0", "type": "t_address" }, { - "astId": 130, - "contract": "contracts/OffsetHelper.sol:OffsetHelper", - "label": "__gap", - "offset": 0, - "slot": "52", - "type": "t_array(t_uint256)49_storage" - }, - { - "astId": 3502, + "astId": 5229, "contract": "contracts/OffsetHelper.sol:OffsetHelper", "label": "eligibleSwapPaths", "offset": 0, - "slot": "101", + "slot": "1", "type": "t_mapping(t_address,t_array(t_address)dyn_storage)" }, { - "astId": 3507, + "astId": 5234, "contract": "contracts/OffsetHelper.sol:OffsetHelper", "label": "eligibleSwapPathsBySymbol", "offset": 0, - "slot": "102", + "slot": "2", "type": "t_mapping(t_string_memory_ptr,t_array(t_address)dyn_storage)" }, { - "astId": 3509, - "contract": "contracts/OffsetHelper.sol:OffsetHelper", - "label": "dexRouterAddress", - "offset": 0, - "slot": "103", - "type": "t_address" - }, - { - "astId": 3512, + "astId": 5237, "contract": "contracts/OffsetHelper.sol:OffsetHelper", "label": "poolAddresses", "offset": 0, - "slot": "104", + "slot": "3", "type": "t_array(t_address)dyn_storage" }, { - "astId": 3515, + "astId": 5240, "contract": "contracts/OffsetHelper.sol:OffsetHelper", "label": "tokenSymbolsForPaths", "offset": 0, - "slot": "105", + "slot": "4", "type": "t_array(t_string_storage)dyn_storage" }, { - "astId": 3519, + "astId": 5244, "contract": "contracts/OffsetHelper.sol:OffsetHelper", "label": "paths", "offset": 0, - "slot": "106", + "slot": "5", "type": "t_array(t_array(t_address)dyn_storage)dyn_storage" }, { - "astId": 3525, + "astId": 5246, "contract": "contracts/OffsetHelper.sol:OffsetHelper", - "label": "balances", + "label": "dexRouterAddress", "offset": 0, - "slot": "107", - "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + "slot": "6", + "type": "t_address" } ], "types": { @@ -1280,23 +1162,6 @@ "label": "string[]", "numberOfBytes": "32" }, - "t_array(t_uint256)49_storage": { - "base": "t_uint256", - "encoding": "inplace", - "label": "uint256[49]", - "numberOfBytes": "1568" - }, - "t_array(t_uint256)50_storage": { - "base": "t_uint256", - "encoding": "inplace", - "label": "uint256[50]", - "numberOfBytes": "1600" - }, - "t_bool": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - }, "t_mapping(t_address,t_array(t_address)dyn_storage)": { "encoding": "mapping", "key": "t_address", @@ -1304,20 +1169,6 @@ "numberOfBytes": "32", "value": "t_array(t_address)dyn_storage" }, - "t_mapping(t_address,t_mapping(t_address,t_uint256))": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => mapping(address => uint256))", - "numberOfBytes": "32", - "value": "t_mapping(t_address,t_uint256)" - }, - "t_mapping(t_address,t_uint256)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => uint256)", - "numberOfBytes": "32", - "value": "t_uint256" - }, "t_mapping(t_string_memory_ptr,t_array(t_address)dyn_storage)": { "encoding": "mapping", "key": "t_string_memory_ptr", @@ -1334,16 +1185,6 @@ "encoding": "bytes", "label": "string", "numberOfBytes": "32" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - }, - "t_uint8": { - "encoding": "inplace", - "label": "uint8", - "numberOfBytes": "1" } } } diff --git a/deployments/alfajores/solcInputs/75278ec65526f1e0033cc879f57dc68d.json b/deployments/alfajores/solcInputs/75278ec65526f1e0033cc879f57dc68d.json new file mode 100644 index 0000000..1869077 --- /dev/null +++ b/deployments/alfajores/solcInputs/75278ec65526f1e0033cc879f57dc68d.json @@ -0,0 +1,125 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822ProxiableUpgradeable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeaconUpgradeable {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeaconUpgradeable.sol\";\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/StorageSlotUpgradeable.sol\";\nimport \"../utils/Initializable.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967UpgradeUpgradeable is Initializable {\n function __ERC1967Upgrade_init() internal onlyInitializing {\n }\n\n function __ERC1967Upgrade_init_unchained() internal onlyInitializing {\n }\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(AddressUpgradeable.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n _functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Emitted when the beacon is upgraded.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(AddressUpgradeable.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\n }\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return AddressUpgradeable.verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Internal function that returns the initialized version. Returns `_initialized`\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Internal function that returns the initialized version. Returns `_initializing`\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../ERC1967/ERC1967UpgradeUpgradeable.sol\";\nimport \"./Initializable.sol\";\n\n/**\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\n *\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\n * `UUPSUpgradeable` with a custom implementation of upgrades.\n *\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\n *\n * _Available since v4.1._\n */\nabstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {\n function __UUPSUpgradeable_init() internal onlyInitializing {\n }\n\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\n }\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\n address private immutable __self = address(this);\n\n /**\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\n * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\n * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\n * fail.\n */\n modifier onlyProxy() {\n require(address(this) != __self, \"Function must be called through delegatecall\");\n require(_getImplementation() == __self, \"Function must be called through active proxy\");\n _;\n }\n\n /**\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\n * callable on the implementing contract but not through proxies.\n */\n modifier notDelegated() {\n require(address(this) == __self, \"UUPSUpgradeable: must not be called through delegatecall\");\n _;\n }\n\n /**\n * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\n */\n function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\n return _IMPLEMENTATION_SLOT;\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n */\n function upgradeTo(address newImplementation) external virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\n * encoded in `data`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n */\n function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, data, true);\n }\n\n /**\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\n * {upgradeTo} and {upgradeToAndCall}.\n *\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\n *\n * ```solidity\n * function _authorizeUpgrade(address) internal override onlyOwner {}\n * ```\n */\n function _authorizeUpgrade(address newImplementation) internal virtual;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlotUpgradeable {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol": { + "content": "pragma solidity >=0.6.2;\n\ninterface IUniswapV2Router01 {\n function factory() external pure returns (address);\n function WETH() external pure returns (address);\n\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint amountADesired,\n uint amountBDesired,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline\n ) external returns (uint amountA, uint amountB, uint liquidity);\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) external payable returns (uint amountToken, uint amountETH, uint liquidity);\n function removeLiquidity(\n address tokenA,\n address tokenB,\n uint liquidity,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline\n ) external returns (uint amountA, uint amountB);\n function removeLiquidityETH(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) external returns (uint amountToken, uint amountETH);\n function removeLiquidityWithPermit(\n address tokenA,\n address tokenB,\n uint liquidity,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline,\n bool approveMax, uint8 v, bytes32 r, bytes32 s\n ) external returns (uint amountA, uint amountB);\n function removeLiquidityETHWithPermit(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline,\n bool approveMax, uint8 v, bytes32 r, bytes32 s\n ) external returns (uint amountToken, uint amountETH);\n function swapExactTokensForTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external returns (uint[] memory amounts);\n function swapTokensForExactTokens(\n uint amountOut,\n uint amountInMax,\n address[] calldata path,\n address to,\n uint deadline\n ) external returns (uint[] memory amounts);\n function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)\n external\n payable\n returns (uint[] memory amounts);\n function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)\n external\n returns (uint[] memory amounts);\n function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)\n external\n returns (uint[] memory amounts);\n function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)\n external\n payable\n returns (uint[] memory amounts);\n\n function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);\n function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);\n function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);\n function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);\n function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);\n}\n" + }, + "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol": { + "content": "pragma solidity >=0.6.2;\n\nimport './IUniswapV2Router01.sol';\n\ninterface IUniswapV2Router02 is IUniswapV2Router01 {\n function removeLiquidityETHSupportingFeeOnTransferTokens(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) external returns (uint amountETH);\n function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline,\n bool approveMax, uint8 v, bytes32 r, bytes32 s\n ) external returns (uint amountETH);\n\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external payable;\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n}\n" + }, + "contracts/interfaces/IRetirementCertificates.sol": { + "content": "// SPDX-FileCopyrightText: 2021 Toucan Labs\n//\n// SPDX-License-Identifier: UNLICENSED\n\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\n\nimport \"./IToucanContractRegistry.sol\";\n\ninterface RetirementCertificates is IERC721Upgradeable {\n /// @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n function tokenURI(uint256 tokenId) external returns (string memory);\n\n /// @notice Update retirementMessage, beneficiary, and beneficiaryString of a NFT\n /// within 24h of creation. Empty values are ignored, ie., will not overwrite the\n /// existing stored values in the NFT.\n /// @param tokenId The id of the NFT to update\n /// @param beneficiary The new beneficiary to set in the NFT\n /// @param beneficiaryString The new beneficiaryString to set in the NFT\n /// @param retirementMessage The new retirementMessage to set in the NFT\n /// @dev The function can only be called by a the NFT owner\n function updateCertificate(\n uint256 tokenId,\n address beneficiary,\n string calldata beneficiaryString,\n string calldata retirementMessage\n ) external;\n}\n" + }, + "contracts/interfaces/IToucanCarbonOffsets.sol": { + "content": "// SPDX-FileCopyrightText: 2021 Toucan Labs\n//\n// SPDX-License-Identifier: UNLICENSED\n\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\n\nimport \"../types/CarbonProjectTypes.sol\";\nimport \"../types/CarbonProjectVintageTypes.sol\";\n\ninterface IToucanCarbonOffsets is IERC20Upgradeable, IERC721Receiver {\n function getGlobalProjectVintageIdentifiers()\n external\n view\n returns (string memory, string memory);\n\n function getAttributes()\n external\n view\n returns (ProjectData memory, VintageData memory);\n\n function getRemaining() external view returns (uint256 remaining);\n\n function getDepositCap() external view returns (uint256);\n\n function retire(uint256 amount) external;\n\n function retireFrom(address account, uint256 amount) external;\n\n function mintCertificateLegacy(\n string calldata retiringEntityString,\n address beneficiary,\n string calldata beneficiaryString,\n string calldata retirementMessage,\n uint256 amount\n ) external;\n\n function retireAndMintCertificate(\n string calldata retiringEntityString,\n address beneficiary,\n string calldata beneficiaryString,\n string calldata retirementMessage,\n uint256 amount\n ) external;\n}\n" + }, + "contracts/interfaces/IToucanContractRegistry.sol": { + "content": "// SPDX-FileCopyrightText: 2021 Toucan Labs\n//\n// SPDX-License-Identifier: UNLICENSED\n\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\npragma solidity ^0.8.0;\n\ninterface IToucanContractRegistry {\n function carbonOffsetBatchesAddress() external view returns (address);\n\n function carbonProjectsAddress() external view returns (address);\n\n function carbonProjectVintagesAddress() external view returns (address);\n\n function toucanCarbonOffsetsFactoryAddress()\n external\n view\n returns (address);\n\n function carbonOffsetBadgesAddress() external view returns (address);\n\n function checkERC20(address _address) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IToucanPoolToken.sol": { + "content": "// SPDX-FileCopyrightText: 2021 Toucan Labs\n//\n// SPDX-License-Identifier: UNLICENSED\n\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\ninterface IToucanPoolToken is IERC20Upgradeable {\n function deposit(address erc20Addr, uint256 amount) external;\n\n function checkEligible(address erc20Addr) external view returns (bool);\n\n function checkAttributeMatching(address erc20Addr)\n external\n view\n returns (bool);\n\n function calculateRedeemFees(\n address[] memory tco2s,\n uint256[] memory amounts\n ) external view returns (uint256);\n\n function redeemMany(address[] memory tco2s, uint256[] memory amounts)\n external;\n\n function redeemAuto(uint256 amount) external;\n\n function redeemAuto2(uint256 amount)\n external\n returns (address[] memory tco2s, uint256[] memory amounts);\n\n function getRemaining() external view returns (uint256);\n\n function getScoredTCO2s() external view returns (address[] memory);\n}\n" + }, + "contracts/OffsetHelper.sol": { + "content": "// SPDX-FileCopyrightText: 2022 Toucan Labs\n// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\";\nimport \"./OffsetHelperStorage.sol\";\nimport \"./interfaces/IToucanPoolToken.sol\";\nimport \"./interfaces/IToucanCarbonOffsets.sol\";\nimport \"./interfaces/IToucanContractRegistry.sol\";\n\n/**\n * @title Toucan Protocol Offset Helpers\n * @notice Helper functions that simplify the carbon offsetting (retirement)\n * process.\n *\n * Retiring carbon tokens requires multiple steps and interactions with\n * Toucan Protocol's main contracts:\n * 1. Obtain a pool token e.g., NCT (by performing a token\n * swap on a DEX).\n * 2. Redeem the pool token for a TCO2 token.\n * 3. Retire the TCO2 token.\n *\n * These steps are combined in each of the following \"auto offset\" methods\n * implemented in `OffsetHelper` to allow a retirement within one transaction:\n * - `autoOffsetPoolToken()` if the user already owns a Toucan pool\n * token e.g., NCT,\n * - `autoOffsetExactOutETH()` if the user would like to perform a retirement\n * using native tokens e.g., MATIC, specifying the exact amount of TCO2s to retire (only on Polygon, not on Celo),\n * - `autoOffsetExactInETH()` if the user would like to perform a retirement\n * using native tokens, swapping all sent native tokens into TCO2s (only on Polygon, not on Celo),\n * - `autoOffsetExactOutToken()` if the user would like to perform a retirement\n * using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount\n * of TCO2s to retire,\n * - `autoOffsetExactInToken()` if the user would like to perform a retirement\n * using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount\n * of token to swap into TCO2s.\n *\n * In these methods, \"auto\" refers to the fact that these methods use\n * `autoRedeem()` in order to automatically choose a TCO2 token corresponding\n * to the oldest tokenized carbon project in the specfified token pool.\n * There are no fees incurred by the user when using `autoRedeem()`, i.e., the\n * user receives 1 TCO2 token for each pool token (BCT/NCT) redeemed.\n *\n * There are two `view` helper functions `calculateNeededETHAmount()` and\n * `calculateNeededTokenAmount()` that should be called before using\n * `autoOffsetExactOutETH()` and `autoOffsetExactOutToken()`, to determine how\n * much native tokens e.g., MATIC, respectively how much of the ERC20 token must be sent to the\n * `OffsetHelper` contract in order to retire the specified amount of carbon.\n *\n * The two `view` helper functions `calculateExpectedPoolTokenForETH()` and\n * `calculateExpectedPoolTokenForToken()` can be used to calculate the\n * expected amount of TCO2s that will be offset using functions\n * `autoOffsetExactInETH()` and `autoOffsetExactInToken()`.\n */\ncontract OffsetHelper is OffsetHelperStorage {\n using SafeERC20 for IERC20;\n // As Celo allows to pay the gas fees with other tokens than the native token,\n // it's not possible ot use the swapETH (swap native tokens) functions.\n uint256 private constant CELO_MAINNET_CHAINID = 42220;\n uint256 private constant ALFAJORES_MAINNET_CHAINID = 44787;\n\n /**\n * @notice Emitted upon successful redemption of TCO2 tokens from a Toucan\n * pool token e.g., NCT.\n *\n * @param sender The sender of the transaction\n * @param poolToken The address of the pool token used in the\n * redemption, e.g., NCT\n * @param tco2s An array of the TCO2 addresses that were redeemed\n * @param amounts An array of the amounts of each TCO2 that were redeemed\n */\n event Redeemed(\n address sender,\n address poolToken,\n address[] tco2s,\n uint256[] amounts\n );\n\n modifier onlyRedeemable(address _token) {\n require(isRedeemable(_token), \"Token not redeemable.\");\n\n _;\n }\n\n modifier onlySwappable(address _token) {\n require(isSwappable(_token), \"Path doesn't yet exist.\");\n\n _;\n }\n\n modifier isNotCelo() {\n require(\n block.chainid != CELO_MAINNET_CHAINID &&\n block.chainid != ALFAJORES_MAINNET_CHAINID,\n \"The function is not available on Celo.\"\n );\n\n _;\n }\n\n /**\n * @notice Contract constructor. Should specify arrays of ERC20 symbols and\n * addresses that can used by the contract.\n *\n * @dev See `isEligible()` for a list of tokens that can be used in the\n * contract. These can be modified after deployment by the contract owner\n * using `setEligibleTokenAddress()` and `deleteEligibleTokenAddress()`.\n *\n * @param _poolAddresses A list of pool token addresses.\n * @param _tokenSymbolsForPaths An array of symbols of the token the user want to retire carbon credits for\n * @param _paths An array of arrays of addresses to describe the path needed to swap form the baseToken to the pool Token\n * to the provided token symbols.\n */\n constructor(\n address[] memory _poolAddresses,\n string[] memory _tokenSymbolsForPaths,\n address[][] memory _paths,\n address _dexRouterAddress\n ) {\n poolAddresses = _poolAddresses;\n tokenSymbolsForPaths = _tokenSymbolsForPaths;\n paths = _paths;\n dexRouterAddress = _dexRouterAddress;\n\n uint256 eligibleSwapPathsBySymbolLen = _tokenSymbolsForPaths.length;\n for (uint256 i; i < eligibleSwapPathsBySymbolLen; i++) {\n eligibleSwapPaths[_paths[i][0]] = _paths[i];\n eligibleSwapPathsBySymbol[_tokenSymbolsForPaths[i]] = _paths[i];\n }\n }\n\n // The receive and fallback method are needed to fix the situation where transfering dust native tokens\n // in the native tokens to token swap fails\n receive() external payable {}\n\n // ----------------------------------------\n // Public functions\n // ----------------------------------------\n\n /**\n * @notice Retire carbon credits using the oldest TCO2\n * tokens available from the specified Toucan token pool by sending ERC20\n * tokens (cUSD, USDC, WETH, WMATIC). Use `calculateNeededTokenAmount` first in\n * order to find out how much of the ERC20 token is required to retire the\n * specified quantity of TCO2.\n *\n * This function:\n * 1. Swaps the ERC20 token sent to the contract for the specified pool token.\n * 2. Redeems the pool token for the oldest TCO2 tokens available.\n * 3. Retires the TCO2 tokens.\n *\n * Note: The client must approve the ERC20 token that is sent to the contract.\n *\n * @dev When automatically redeeming pool tokens for the oldest ones\n * TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool\n * token.\n *\n * @param _fromToken The address of the ERC20 token that the user sends\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\n * @param _poolToken The address of the pool token that the\n * user wants to use, e.g., NCT\n * @param _amountToOffset The amount of TCO2 to offset\n *\n * @return tco2s An array of the TCO2 addresses that were redeemed\n * @return amounts An array of the amounts of each TCO2 that were redeemed\n */\n function autoOffsetExactOutToken(\n address _fromToken,\n address _poolToken,\n uint256 _amountToOffset\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\n // swap input token for BCT / NCT\n swapExactOutToken(_fromToken, _poolToken, _amountToOffset);\n\n // redeem BCT / NCT for TCO2s\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\n\n // retire the TCO2s to achieve offset\n autoRetire(tco2s, amounts);\n }\n\n /**\n * @notice Retire carbon credits using the oldest TCO2\n * tokens available from the specified Toucan token pool by sending ERC20\n * tokens (cUSD, USDC, WETH, WMATIC). All provided token is consumed for\n * offsetting. Use `calculateExpectedPoolTokenForToken()` to calculate the expected amount\n * of Pool token that can be acquired by swapping the provided amount of ERC20 token.\n *\n * This function:\n * 1. Swaps the ERC20 token sent to the contract for the specified pool token.\n * 2. Redeems the pool token for the oldest TCO2 tokens available.\n * 3. Retires the TCO2 tokens.\n *\n * Note: The client must approve the ERC20 token that is sent to the contract.\n *\n * @dev When automatically redeeming pool tokens for the oldest ones\n * TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool\n * token.\n *\n * @param _fromToken The address of the ERC20 token that the user sends\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\n * @param _poolToken The address of the pool token that the\n * user wants to use, e.g., NCT\n * @param _amountToSwap The amount of ERC20 token to swap into Toucan pool\n * token. Full amount will be used for offsetting.\n *\n * @return tco2s An array of the TCO2 addresses that were redeemed\n * @return amounts An array of the amounts of each TCO2 that were redeemed\n */\n function autoOffsetExactInToken(\n address _fromToken,\n address _poolToken,\n uint256 _amountToSwap\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\n // swap input token for BCT / NCT\n uint256 amountToOffset = swapExactInToken(\n _fromToken,\n _poolToken,\n _amountToSwap\n );\n\n // redeem BCT / NCT for TCO2s\n (tco2s, amounts) = autoRedeem(_poolToken, amountToOffset);\n\n // retire the TCO2s to achieve offset\n autoRetire(tco2s, amounts);\n }\n\n /**\n * @notice Retire carbon credits using the oldest TCO2\n * tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC.\n * Use `calculateNeededETHAmount()` first in order to find out how much\n * native tokens are required to retire the specified quantity of TCO2.\n *\n * This function:\n * 1. Swaps the Matic sent to the contract for the specified pool token.\n * 2. Redeems the pool token for the oldest TCO2 tokens available.\n * 3. Retires the TCO2 tokens.\n *\n * @dev If the user sends too much native tokens , the leftover amount will be sent back\n * to the user. This function is only available on Polygon, not on Celo.\n *\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n * @param _amountToOffset The amount of TCO2 to offset.\n *\n * @return tco2s An array of the TCO2 addresses that were redeemed\n * @return amounts An array of the amounts of each TCO2 that were redeemed\n */\n function autoOffsetExactOutETH(\n address _poolToken,\n uint256 _amountToOffset\n )\n public\n payable\n isNotCelo\n returns (address[] memory tco2s, uint256[] memory amounts)\n {\n // swap native tokens for BCT / NCT\n swapExactOutETH(_poolToken, _amountToOffset);\n\n // redeem BCT / NCT for TCO2s\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\n\n // retire the TCO2s to achieve offset\n autoRetire(tco2s, amounts);\n }\n\n /**\n * @notice Retire carbon credits using the oldest TCO2\n * tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC.\n * All provided native tokens is consumed for offsetting.\n * Use `calculateExpectedPoolTokenForETH()` to calculate the expected amount of\n * Pool token that can be acquired by swapping the provided amount of native tokens e.g., MATIC.\n *\n * This function:\n * 1. Swaps the Matic sent to the contract for the specified pool token.\n * 2. Redeems the pool token for the oldest TCO2 tokens available.\n * 3. Retires the TCO2 tokens.\n *\n * @dev This function is only available on Polygon, not on Celo.\n *\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n *\n * @return tco2s An array of the TCO2 addresses that were redeemed\n * @return amounts An array of the amounts of each TCO2 that were redeemed\n */\n function autoOffsetExactInETH(\n address _poolToken\n )\n public\n payable\n isNotCelo\n returns (address[] memory tco2s, uint256[] memory amounts)\n {\n // swap native tokens for BCT / NCT\n uint256 amountToOffset = swapExactInETH(_poolToken);\n\n // redeem BCT / NCT for TCO2s\n (tco2s, amounts) = autoRedeem(_poolToken, amountToOffset);\n\n // retire the TCO2s to achieve offset\n autoRetire(tco2s, amounts);\n }\n\n /**\n * @notice Retire carbon credits using the oldest TCO2\n * tokens available by sending pool tokens, e.g., NCT.\n *\n * This function:\n * 1. Redeems the pool token for the oldest TCO2 tokens available.\n * 2. Retires the TCO2 tokens.\n *\n * Note: The client must approve the pool token that is sent.\n *\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n * @param _amountToOffset The amount of TCO2 to offset.\n *\n * @return tco2s An array of the TCO2 addresses that were redeemed\n * @return amounts An array of the amounts of each TCO2 that were redeemed\n */\n function autoOffsetPoolToken(\n address _poolToken,\n uint256 _amountToOffset\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\n // deposit pool token from user to this contract\n IERC20(_poolToken).safeTransferFrom(\n msg.sender,\n address(this),\n _amountToOffset\n );\n\n // redeem BCT / NCT for TCO2s\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\n\n // retire the TCO2s to achieve offset\n autoRetire(tco2s, amounts);\n }\n\n /**\n * @notice Redeems the specified amount of NCT / BCT for TCO2.\n * @dev Needs to be approved on the client side\n * @param _fromToken Could be the address of NCT\n * @param _amount Amount to redeem\n * @return tco2s An array of the TCO2 addresses that were redeemed\n * @return amounts An array of the amounts of each TCO2 that were redeemed\n */\n function autoRedeem(\n address _fromToken,\n uint256 _amount\n )\n public\n onlyRedeemable(_fromToken)\n returns (address[] memory tco2s, uint256[] memory amounts)\n {\n require(\n IERC20(_fromToken).balanceOf(address(this)) >= _amount,\n \"Insufficient NCT/BCT balance\"\n );\n\n // instantiate pool token (NCT)\n IToucanPoolToken PoolTokenImplementation = IToucanPoolToken(_fromToken);\n\n // auto redeem pool token for TCO2; will transfer automatically picked TCO2 to this contract\n (tco2s, amounts) = PoolTokenImplementation.redeemAuto2(_amount);\n\n emit Redeemed(msg.sender, _fromToken, tco2s, amounts);\n }\n\n /**\n * @notice Retire the specified TCO2 tokens.\n * @param _tco2s The addresses of the TCO2s to retire\n * @param _amounts The amounts to retire from each of the corresponding\n * TCO2 addresses\n */\n function autoRetire(\n address[] memory _tco2s,\n uint256[] memory _amounts\n ) public {\n uint256 tco2sLen = _tco2s.length;\n require(tco2sLen != 0, \"Array empty\");\n\n require(tco2sLen == _amounts.length, \"Arrays unequal\");\n\n for (uint i = 0; i < tco2sLen; i++) {\n if (_amounts[i] == 0) {\n continue;\n }\n require(\n IERC20(_tco2s[i]).balanceOf(address(this)) >= _amounts[i],\n \"Insufficient TCO2 balance\"\n );\n\n IToucanCarbonOffsets(_tco2s[i]).retire(_amounts[i]);\n }\n }\n\n /**\n * @notice Swap eligible ERC20 tokens for pool tokens (BCT/NCT) on SushiSwap\n * @dev Needs to be approved on the client side\n * @param _fromToken The address of the ERC20 token used for the swap\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n * @param _toAmount The required amount of the pool token (NCT/BCT)\n */\n function swapExactOutToken(\n address _fromToken,\n address _poolToken,\n uint256 _toAmount\n ) public onlySwappable(_fromToken) onlyRedeemable(_poolToken) {\n // calculate path & amounts\n (\n address[] memory path,\n uint256[] memory expAmounts\n ) = calculateExactOutSwap(_fromToken, _poolToken, _toAmount);\n uint256 amountIn = expAmounts[0];\n\n // transfer tokens\n IERC20(_fromToken).safeTransferFrom(\n msg.sender,\n address(this),\n amountIn\n );\n\n // approve router\n IERC20(_fromToken).approve(dexRouterAddress, amountIn);\n\n // swap\n uint256[] memory amounts = dexRouter().swapTokensForExactTokens(\n _toAmount,\n amountIn, // max. input amount\n path,\n address(this),\n block.timestamp\n );\n\n // remove remaining approval if less input token was consumed\n if (amounts[0] < amountIn) {\n IERC20(_fromToken).approve(dexRouterAddress, 0);\n }\n }\n\n /**\n * @notice Swap eligible ERC20 tokens for pool tokens (BCT/NCT) on\n * SushiSwap. All provided ERC20 tokens will be swapped.\n * @dev Needs to be approved on the client side.\n * @param _fromToken The address of the ERC20 token used for the swap\n * @param _poolToken The address of the pool token to swap for,\n * @param _fromAmount The amount of ERC20 token to swap\n * e.g., NCT\n * @return amountOut Resulting amount of pool token that got acquired for the\n * swapped ERC20 tokens.\n */\n function swapExactInToken(\n address _fromToken,\n address _poolToken,\n uint256 _fromAmount\n )\n public\n onlySwappable(_fromToken)\n onlyRedeemable(_poolToken)\n returns (uint256 amountOut)\n {\n // calculate path & amounts\n address[] memory path = generatePath(_fromToken, _poolToken);\n\n uint256 len = path.length;\n\n // transfer tokens\n IERC20(_fromToken).safeTransferFrom(\n msg.sender,\n address(this),\n _fromAmount\n );\n\n // approve router\n IERC20(_fromToken).safeApprove(dexRouterAddress, _fromAmount);\n\n // swap\n uint256[] memory amounts = dexRouter().swapExactTokensForTokens(\n _fromAmount,\n 0, // min. output amount\n path,\n address(this),\n block.timestamp\n );\n amountOut = amounts[len - 1];\n }\n\n /**\n * @notice Swap native tokens e.g., MATIC for pool tokens (BCT/NCT) on SushiSwap.\n * Remaining native tokens that was not consumed by the swap is returned.\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n * @param _toAmount The required amount of the pool token (NCT/BCT)\n */\n function swapExactOutETH(\n address _poolToken,\n uint256 _toAmount\n ) public payable isNotCelo onlyRedeemable(_poolToken) {\n // create path & amounts\n // wrap the native token\n address fromToken = eligibleSwapPathsBySymbol[\"WMATIC\"][0];\n address[] memory path = generatePath(fromToken, _poolToken);\n\n // swap\n uint256[] memory amounts = dexRouter().swapETHForExactTokens{\n value: msg.value\n }(_toAmount, path, address(this), block.timestamp);\n\n // send surplus back\n if (msg.value > amounts[0]) {\n uint256 leftoverETH = msg.value - amounts[0];\n (bool success, ) = msg.sender.call{value: leftoverETH}(\n new bytes(0)\n );\n\n require(success, \"Failed to send surplus back\");\n }\n }\n\n /**\n * @notice Swap native tokens e.g., MATIC for pool tokens (BCT/NCT) on SushiSwap. All\n * provided native tokens will be swapped.\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n * @return amountOut Resulting amount of pool token that got acquired for the\n * swapped native tokens .\n */\n function swapExactInETH(\n address _poolToken\n )\n public\n payable\n isNotCelo\n onlyRedeemable(_poolToken)\n returns (uint256 amountOut)\n {\n // create path & amounts\n uint256 fromAmount = msg.value;\n // wrap the native token\n address fromToken = eligibleSwapPathsBySymbol[\"WMATIC\"][0];\n address[] memory path = generatePath(fromToken, _poolToken);\n\n uint256 len = path.length;\n\n // swap\n uint256[] memory amounts = dexRouter().swapExactETHForTokens{\n value: fromAmount\n }(0, path, address(this), block.timestamp);\n amountOut = amounts[len - 1];\n }\n\n // ----------------------------------------\n // Public view functions\n // ----------------------------------------\n\n /**\n * @notice Return how much of the specified ERC20 token is required in\n * order to swap for the desired amount of a pool token, for\n * example, e.g., NCT.\n *\n * @param _fromToken The address of the ERC20 token used for the swap\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n * @param _toAmount The desired amount of pool token to receive\n * @return amountIn The amount of the ERC20 token required in order to\n * swap for the specified amount of the pool token\n */\n function calculateNeededTokenAmount(\n address _fromToken,\n address _poolToken,\n uint256 _toAmount\n )\n public\n view\n onlySwappable(_fromToken)\n onlyRedeemable(_poolToken)\n returns (uint256 amountIn)\n {\n (, uint256[] memory amounts) = calculateExactOutSwap(\n _fromToken,\n _poolToken,\n _toAmount\n );\n amountIn = amounts[0];\n }\n\n /**\n * @notice Return how much native tokens e.g, MATIC is required in order to swap for the\n * desired amount of a pool token, e.g., NCT.\n * @param _poolToken The address of the pool token to swap for, for\n * example, NCT\n * @param _toAmount The desired amount of pool token to receive\n * @return amountIn The amount of native tokens required in order to swap for\n * the specified amount of the pool token\n */\n function calculateNeededETHAmount(\n address _poolToken,\n uint256 _toAmount\n ) public view onlyRedeemable(_poolToken) returns (uint256 amountIn) {\n address fromToken = eligibleSwapPathsBySymbol[\"WMATIC\"][0];\n (, uint256[] memory amounts) = calculateExactOutSwap(\n fromToken,\n _poolToken,\n _toAmount\n );\n amountIn = amounts[0];\n }\n\n /**\n * @notice Calculates the expected amount of pool token that can be\n * acquired by swapping the provided amount of ERC20 token.\n *\n * @param _fromToken The address of the ERC20 token used for the swap\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n * @param _fromAmount The amount of ERC20 token to swap\n * @return amountOut The expected amount of Pool token that can be acquired\n */\n function calculateExpectedPoolTokenForToken(\n address _fromToken,\n address _poolToken,\n uint256 _fromAmount\n )\n public\n view\n onlySwappable(_fromToken)\n onlyRedeemable(_poolToken)\n returns (uint256 amountOut)\n {\n (, uint256[] memory amounts) = calculateExactInSwap(\n _fromToken,\n _poolToken,\n _fromAmount\n );\n amountOut = amounts[amounts.length - 1];\n }\n\n /**\n * @notice Calculates the expected amount of pool token that can be\n * acquired by swapping the provided amount of native tokens e.g., MATIC.\n *\n * @param _fromTokenAmount The amount of native tokens to swap\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n * @return amountOut The expected amount of Pool token that can be acquired\n */\n function calculateExpectedPoolTokenForETH(\n address _poolToken,\n uint256 _fromTokenAmount\n )\n public\n view\n isNotCelo\n onlyRedeemable(_poolToken)\n returns (uint256 amountOut)\n {\n address fromToken = eligibleSwapPathsBySymbol[\"WMATIC\"][0];\n (, uint256[] memory amounts) = calculateExactInSwap(\n fromToken,\n _poolToken,\n _fromTokenAmount\n );\n amountOut = amounts[amounts.length - 1];\n }\n\n // ----------------------------------------\n // Internal functions\n // ----------------------------------------\n\n function calculateExactOutSwap(\n address _fromToken,\n address _poolToken,\n uint256 _toAmount\n ) internal view returns (address[] memory path, uint256[] memory amounts) {\n // create path & calculate amounts\n path = generatePath(_fromToken, _poolToken);\n uint256 len = path.length;\n\n amounts = dexRouter().getAmountsIn(_toAmount, path);\n\n // sanity check arrays\n require(len == amounts.length, \"Arrays unequal\");\n require(_toAmount == amounts[len - 1], \"Output amount mismatch\");\n }\n\n function calculateExactInSwap(\n address _fromToken,\n address _poolToken,\n uint256 _fromAmount\n ) internal view returns (address[] memory path, uint256[] memory amounts) {\n // create path & calculate amounts\n path = generatePath(_fromToken, _poolToken);\n uint256 len = path.length;\n\n amounts = dexRouter().getAmountsOut(_fromAmount, path);\n\n // sanity check arrays\n require(len == amounts.length, \"Arrays unequal\");\n require(_fromAmount == amounts[0], \"Input amount mismatch\");\n }\n\n /**\n * @notice Show all pool token addresses that can be used to retired.\n * @param _fromToken a list of token symbols that can be retired.\n * @param _toToken a list of token symbols that can be retired.\n */\n function generatePath(\n address _fromToken,\n address _toToken\n ) internal view returns (address[] memory path) {\n uint256 len = eligibleSwapPaths[_fromToken].length;\n if (len == 1) {\n path = new address[](2);\n path[0] = _fromToken;\n path[1] = _toToken;\n return path;\n }\n if (len == 2) {\n path = new address[](3);\n path[0] = _fromToken;\n path[1] = eligibleSwapPaths[_fromToken][1];\n path[2] = _toToken;\n return path;\n }\n if (len == 3) {\n path = new address[](3);\n path[0] = _fromToken;\n path[1] = eligibleSwapPaths[_fromToken][1];\n path[2] = eligibleSwapPaths[_fromToken][2];\n path[3] = _toToken;\n return path;\n } else {\n path = new address[](4);\n path[0] = _fromToken;\n path[1] = eligibleSwapPaths[_fromToken][1];\n path[2] = eligibleSwapPaths[_fromToken][2];\n path[3] = eligibleSwapPaths[_fromToken][3];\n path[4] = _toToken;\n return path;\n }\n }\n\n function dexRouter() internal view returns (IUniswapV2Router02) {\n return IUniswapV2Router02(dexRouterAddress);\n }\n\n // ----------------------------------------\n // Private functions\n // ----------------------------------------\n\n /**\n * @notice Checks whether an address is a pool token address\n * @param _erc20Address address of token to be checked\n * @return True if the address is a pool token address\n */\n function isRedeemable(address _erc20Address) private view returns (bool) {\n for (uint i = 0; i < poolAddresses.length; i++) {\n if (poolAddresses[i] == _erc20Address) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * @notice Checks whether an address can be used in a token swap\n * @param _erc20Address address of token to be checked\n * @return True if the specified address can be used in a swap\n */\n function isSwappable(address _erc20Address) private view returns (bool) {\n for (uint i = 0; i < paths.length; i++) {\n if (paths[i][0] == _erc20Address) {\n return true;\n }\n }\n\n return false;\n }\n\n // ----------------------------------------\n // Admin methods\n // ----------------------------------------\n\n /**\n * @notice Checks if ERC20 Token is eligible for Offsetting.\n * @param _erc20Address The address of the ERC20 token that the user sends\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\n * @return _path Returns the path of the token to be exchanged\n */\n\n function isERC20AddressEligible(\n address _erc20Address\n ) public view returns (address[] memory _path) {\n _path = eligibleSwapPaths[_erc20Address];\n }\n\n /**\n * @notice Change or add eligible paths and their addresses.\n * @param _tokenSymbol The symbol of the token to add\n * @param _path The path of the path to add\n */\n function addPath(\n string memory _tokenSymbol,\n address[] memory _path\n ) public virtual onlyOwner {\n eligibleSwapPaths[_path[0]] = _path;\n eligibleSwapPathsBySymbol[_tokenSymbol] = _path;\n tokenSymbolsForPaths.push(_tokenSymbol);\n }\n\n /**\n * @notice Delete eligible tokens stored in the contract.\n * @param _tokenSymbol The symbol of the path to remove\n */\n function removePath(string memory _tokenSymbol) public virtual onlyOwner {\n delete eligibleSwapPaths[eligibleSwapPathsBySymbol[_tokenSymbol][0]];\n delete eligibleSwapPathsBySymbol[_tokenSymbol];\n }\n\n /**\n * @notice Cheks if Pool Token is eligible for Offsetting.\n * @param _poolToken The addresses of the pool token to redeem\n * @return _isEligible Returns if token can be redeemed\n */\n\n function isPoolAddressEligible(\n address _poolToken\n ) public view returns (bool _isEligible) {\n _isEligible = isRedeemable(_poolToken);\n }\n\n /**\n * @notice Change or add pool token addresses.\n * @param _poolToken The address of the pool token to add\n */\n function addPoolToken(address _poolToken) public virtual onlyOwner {\n poolAddresses.push(_poolToken);\n }\n\n /**\n * @notice Delete eligible pool token addresses stored in the contract.\n * @param _poolToken The address of the pool token to remove\n */\n function removePoolToken(address _poolToken) public virtual onlyOwner {\n for (uint256 i; i < poolAddresses.length; i++) {\n if (poolAddresses[i] == _poolToken) {\n poolAddresses[i] = poolAddresses[poolAddresses.length - 1];\n poolAddresses.pop();\n break;\n }\n }\n }\n}\n" + }, + "contracts/OffsetHelperStorage.sol": { + "content": "// SPDX-FileCopyrightText: 2022 Toucan Labs\n//\n// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract OffsetHelperStorage is Ownable {\n // token symbol => token address\n mapping(address => address[]) public eligibleSwapPaths;\n mapping(string => address[]) public eligibleSwapPathsBySymbol;\n\n address[] public poolAddresses;\n string[] public tokenSymbolsForPaths;\n address[][] public paths;\n address public dexRouterAddress;\n}\n" + }, + "contracts/types/CarbonProjectTypes.sol": { + "content": "// SPDX-FileCopyrightText: 2021 Toucan Labs\n//\n// SPDX-License-Identifier: UNLICENSED\n\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\n\npragma solidity >=0.8.4 <0.9.0;\n\n/// @dev CarbonProject related data and attributes\nstruct ProjectData {\n string projectId;\n string standard;\n string methodology;\n string region;\n string storageMethod;\n string method;\n string emissionType;\n string category;\n string uri;\n address controller;\n}\n" + }, + "contracts/types/CarbonProjectVintageTypes.sol": { + "content": "// SPDX-FileCopyrightText: 2021 Toucan Labs\n//\n// SPDX-License-Identifier: UNLICENSED\n\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\n\npragma solidity >=0.8.4 <0.9.0;\n\nstruct VintageData {\n /// @dev A human-readable string which differentiates this from other vintages in\n /// the same project, and helps build the corresponding TCO2 name and symbol.\n string name;\n uint64 startTime; // UNIX timestamp\n uint64 endTime; // UNIX timestamp\n uint256 projectTokenId;\n uint64 totalVintageQuantity;\n bool isCorsiaCompliant;\n bool isCCPcompliant;\n string coBenefits;\n string correspAdjustment;\n string additionalCertification;\n string uri;\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/deployments/celo/OffsetHelper.json b/deployments/celo/OffsetHelper.json index 63e50da..fdc286a 100644 --- a/deployments/celo/OffsetHelper.json +++ b/deployments/celo/OffsetHelper.json @@ -1,5 +1,5 @@ { - "address": "0xBf91931336f89E5DBdBd60dA757bDf9D2D14dd6B", + "address": "0x4242829D15434Fea6606CF995f1BEd68a18C37d1", "abi": [ { "inputs": [ @@ -27,19 +27,6 @@ "stateMutability": "nonpayable", "type": "constructor" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -90,10 +77,6 @@ "name": "Redeemed", "type": "event" }, - { - "stateMutability": "payable", - "type": "fallback" - }, { "inputs": [ { @@ -322,30 +305,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "balances", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -452,24 +411,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "_erc20Addr", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "deposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [], "name": "dexRouterAddress", @@ -531,13 +472,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -786,42 +720,39 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "_erc20Addr", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "stateMutability": "payable", "type": "receive" } ], - "transactionHash": "0xdd64a6cd0144188d5efccbabc0246330de3250b33e9bbad8c50861a135033b5d", + "transactionHash": "0xc91af7f1e4fc8766e0b94a29646d5506548e6661f0a9c54c81ca33441d70a807", "receipt": { "to": null, - "from": "0x101b4C436df747B24D17ce43146Da52fa6006C36", - "contractAddress": "0xBf91931336f89E5DBdBd60dA757bDf9D2D14dd6B", - "transactionIndex": 3, - "gasUsed": "4507499", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x063543a45be9629aafd00f16515a4791119c1c82f9faddb2d661ade7710a14c9", - "transactionHash": "0xdd64a6cd0144188d5efccbabc0246330de3250b33e9bbad8c50861a135033b5d", - "logs": [], - "blockNumber": 21371309, - "cumulativeGasUsed": "4843006", + "from": "0xD632d38ae05b2B760f5793b57c69246c26Bf7E8D", + "contractAddress": "0x4242829D15434Fea6606CF995f1BEd68a18C37d1", + "transactionIndex": 0, + "gasUsed": "4309443", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000400000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000002000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000010008000000000000000000000000000000", + "blockHash": "0xbb987c28848dc9d0d897128897653efc05b001d453acf2e18a3c68bf9b21e1a0", + "transactionHash": "0xc91af7f1e4fc8766e0b94a29646d5506548e6661f0a9c54c81ca33441d70a807", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 21984190, + "transactionHash": "0xc91af7f1e4fc8766e0b94a29646d5506548e6661f0a9c54c81ca33441d70a807", + "address": "0x4242829D15434Fea6606CF995f1BEd68a18C37d1", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000d632d38ae05b2b760f5793b57c69246c26bf7e8d" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0xbb987c28848dc9d0d897128897653efc05b001d453acf2e18a3c68bf9b21e1a0" + } + ], + "blockNumber": 21984190, + "cumulativeGasUsed": "4309443", "status": 1, "byzantium": true }, @@ -862,17 +793,17 @@ ], "0x7D28570135A2B1930F331c507F65039D4937f66c" ], - "numDeployments": 6, - "solcInputHash": "9768af37541e90e4200434e6de116099", - "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_poolAddresses\",\"type\":\"address[]\"},{\"internalType\":\"string[]\",\"name\":\"_tokenSymbolsForPaths\",\"type\":\"string[]\"},{\"internalType\":\"address[][]\",\"name\":\"_paths\",\"type\":\"address[][]\"},{\"internalType\":\"address\",\"name\":\"_dexRouterAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"poolToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"Redeemed\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_tokenSymbol\",\"type\":\"string\"},{\"internalType\":\"address[]\",\"name\":\"_path\",\"type\":\"address[]\"}],\"name\":\"addPath\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"addPoolToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"autoOffsetExactInETH\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountToSwap\",\"type\":\"uint256\"}],\"name\":\"autoOffsetExactInToken\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountToOffset\",\"type\":\"uint256\"}],\"name\":\"autoOffsetExactOutETH\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountToOffset\",\"type\":\"uint256\"}],\"name\":\"autoOffsetExactOutToken\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountToOffset\",\"type\":\"uint256\"}],\"name\":\"autoOffsetPoolToken\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"autoRedeem\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_amounts\",\"type\":\"uint256[]\"}],\"name\":\"autoRetire\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"balances\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fromTokenAmount\",\"type\":\"uint256\"}],\"name\":\"calculateExpectedPoolTokenForETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fromAmount\",\"type\":\"uint256\"}],\"name\":\"calculateExpectedPoolTokenForToken\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAmount\",\"type\":\"uint256\"}],\"name\":\"calculateNeededETHAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAmount\",\"type\":\"uint256\"}],\"name\":\"calculateNeededTokenAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_erc20Addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"dexRouterAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"eligibleSwapPaths\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"eligibleSwapPathsBySymbol\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_erc20Address\",\"type\":\"address\"}],\"name\":\"isERC20AddressEligible\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_path\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"isPoolAddressEligible\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_isEligible\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"paths\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"poolAddresses\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_tokenSymbol\",\"type\":\"string\"}],\"name\":\"removePath\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"removePoolToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"swapExactInETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fromAmount\",\"type\":\"uint256\"}],\"name\":\"swapExactInToken\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAmount\",\"type\":\"uint256\"}],\"name\":\"swapExactOutETH\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAmount\",\"type\":\"uint256\"}],\"name\":\"swapExactOutToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"tokenSymbolsForPaths\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_erc20Addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"events\":{\"Redeemed(address,address,address[],uint256[])\":{\"params\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"poolToken\":\"The address of the Toucan pool token used in the redemption, e.g., NCT\",\"sender\":\"The sender of the transaction\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}}},\"kind\":\"dev\",\"methods\":{\"addPath(string,address[])\":{\"params\":{\"_path\":\"The path of the path to add\",\"_tokenSymbol\":\"The symbol of the token to add\"}},\"addPoolToken(address)\":{\"params\":{\"_poolToken\":\"The address of the pool token to add\"}},\"autoOffsetExactInETH(address)\":{\"details\":\"This function is only available on Polygon, not on Celo.\",\"params\":{\"_poolToken\":\"The address of the pool token to offset, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoOffsetExactInToken(address,address,uint256)\":{\"details\":\"When automatically redeeming pool tokens for the lowest quality TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool token.\",\"params\":{\"_amountToSwap\":\"The amount of ERC20 token to swap into Toucan pool token. Full amount will be used for offsetting.\",\"_fromToken\":\"The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\",\"_poolToken\":\"The address of the pool token to offset, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoOffsetExactOutETH(address,uint256)\":{\"details\":\"If the user sends too much native tokens , the leftover amount will be sent back to the user. This function is only available on Polygon, not on Celo.\",\"params\":{\"_amountToOffset\":\"The amount of TCO2 to offset.\",\"_poolToken\":\"The address of the pool token to offset, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoOffsetExactOutToken(address,address,uint256)\":{\"details\":\"When automatically redeeming pool tokens for the lowest quality TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool token.\",\"params\":{\"_amountToOffset\":\"The amount of TCO2 to offset\",\"_fromToken\":\"The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\",\"_poolToken\":\"The address of the Toucan pool token that the user wants to offset, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoOffsetPoolToken(address,uint256)\":{\"params\":{\"_amountToOffset\":\"The amount of TCO2 to offset.\",\"_poolToken\":\"The address of the pool token to offset, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoRedeem(address,uint256)\":{\"details\":\"Needs to be approved on the client side\",\"params\":{\"_amount\":\"Amount to redeem\",\"_fromToken\":\"Could be the address of NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoRetire(address[],uint256[])\":{\"params\":{\"_amounts\":\"The amounts to retire from each of the corresponding TCO2 addresses\",\"_tco2s\":\"The addresses of the TCO2s to retire\"}},\"calculateExpectedPoolTokenForETH(address,uint256)\":{\"params\":{\"_fromTokenAmount\":\"The amount of native tokens to swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amountOut\":\"The expected amount of Pool token that can be acquired\"}},\"calculateExpectedPoolTokenForToken(address,address,uint256)\":{\"params\":{\"_fromAmount\":\"The amount of ERC20 token to swap\",\"_fromToken\":\"The address of the ERC20 token used for the swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amountOut\":\"The expected amount of Pool token that can be acquired\"}},\"calculateNeededETHAmount(address,uint256)\":{\"params\":{\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\",\"_toAmount\":\"The desired amount of pool token to receive\"},\"returns\":{\"amountIn\":\"The amount of native tokens required in order to swap for the specified amount of the pool token\"}},\"calculateNeededTokenAmount(address,address,uint256)\":{\"params\":{\"_fromToken\":\"The address of the ERC20 token used for the swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\",\"_toAmount\":\"The desired amount of pool token to receive\"},\"returns\":{\"amountIn\":\"The amount of the ERC20 token required in order to swap for the specified amount of the pool token\"}},\"constructor\":{\"details\":\"See `isEligible()` for a list of tokens that can be used in the contract. These can be modified after deployment by the contract owner using `setEligibleTokenAddress()` and `deleteEligibleTokenAddress()`.\",\"params\":{\"_paths\":\"An array of arrays of addresses to describe the path needed to swap form the baseToken to the pool Token to the provided token symbols.\",\"_poolAddresses\":\"A list of pool token addresses.\",\"_tokenSymbolsForPaths\":\"An array of symbols of the token the user want to retire carbon credits for\"}},\"deposit(address,uint256)\":{\"details\":\"Needs to be approved\"},\"isERC20AddressEligible(address)\":{\"params\":{\"_erc20Address\":\"The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\"},\"returns\":{\"_path\":\"Returns the path of the token to be exchanged\"}},\"isPoolAddressEligible(address)\":{\"params\":{\"_poolToken\":\"The address of the pool token to offset, e.g., NCT\"},\"returns\":{\"_isEligible\":\"Returns a bool if the Pool token is eligible for offsetting\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"removePath(string)\":{\"params\":{\"_tokenSymbol\":\"The symbol of the path to remove\"}},\"removePoolToken(address)\":{\"params\":{\"_poolToken\":\"The address of the pool token to remove\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"swapExactInETH(address)\":{\"params\":{\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amountOut\":\"Resulting amount of Toucan pool token that got acquired for the swapped native tokens .\"}},\"swapExactInToken(address,address,uint256)\":{\"details\":\"Needs to be approved on the client side.\",\"params\":{\"_fromAmount\":\"The amount of ERC20 token to swap\",\"_fromToken\":\"The address of the ERC20 token used for the swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amountOut\":\"Resulting amount of Toucan pool token that got acquired for the swapped ERC20 tokens.\"}},\"swapExactOutETH(address,uint256)\":{\"params\":{\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\",\"_toAmount\":\"The required amount of the Toucan pool token (NCT/BCT)\"}},\"swapExactOutToken(address,address,uint256)\":{\"details\":\"Needs to be approved on the client side\",\"params\":{\"_fromToken\":\"The address of the ERC20 token used for the swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\",\"_toAmount\":\"The required amount of the Toucan pool token (NCT/BCT)\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"title\":\"Toucan Protocol Offset Helpers\",\"version\":1},\"userdoc\":{\"events\":{\"Redeemed(address,address,address[],uint256[])\":{\"notice\":\"Emitted upon successful redemption of TCO2 tokens from a Toucan pool token e.g., NCT.\"}},\"kind\":\"user\",\"methods\":{\"addPath(string,address[])\":{\"notice\":\"Change or add eligible paths and their addresses.\"},\"addPoolToken(address)\":{\"notice\":\"Change or add pool token addresses.\"},\"autoOffsetExactInETH(address)\":{\"notice\":\"Retire carbon credits using the lowest quality (oldest) TCO2 tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC. All provided native tokens is consumed for offsetting. The `view` helper function `calculateExpectedPoolTokenForETH()` can be used to calculate the expected amount of TCO2s that will be offset using `autoOffsetExactInETH()`. This function: 1. Swaps the native token e.g. MATIC sent to the contract for the specified pool token. 2. Redeems the pool token for the poorest quality TCO2 tokens available. 3. Retires the TCO2 tokens.\"},\"autoOffsetExactInToken(address,address,uint256)\":{\"notice\":\"Retire carbon credits using the lowest quality (oldest) TCO2 tokens available from the specified Toucan token pool by sending ERC20 tokens (cUSD, USDC, WETH, WMATIC). All provided token is consumed for offsetting. The `view` helper function `calculateExpectedPoolTokenForToken()` can be used to calculate the expected amount of TCO2s that will be offset using `autoOffsetExactInToken()`. This function: 1. Swaps the ERC20 token sent to the contract for the specified pool token. 2. Redeems the pool token for the poorest quality TCO2 tokens available. 3. Retires the TCO2 tokens. Note: The client must approve the ERC20 token that is sent to the contract.\"},\"autoOffsetExactOutETH(address,uint256)\":{\"notice\":\"Retire carbon credits using the lowest quality (oldest) TCO2 tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC. The `view` helper function `calculateNeededETHAmount()` should be called before using `autoOffsetExactOutETH()`, to determine how much native tokens e.g., MATIC must be sent to the `OffsetHelper` contract in order to retire the specified amount of carbon. This function: 1. Swaps the native token e.g. MATIC sent to the contract for the specified pool token. 2. Redeems the pool token for the poorest quality TCO2 tokens available. 3. Retires the TCO2 tokens.\"},\"autoOffsetExactOutToken(address,address,uint256)\":{\"notice\":\"Retire carbon credits using the lowest quality (oldest) TCO2 tokens available from the specified Toucan token pool by sending ERC20 tokens (cUSD, USDC, WETH, WMATIC). The `view` helper function `calculateNeededTokenAmount()` should be called before using `autoOffsetExactOutToken()`, to determine how much native tokens e.g., MATIC must be sent to the `OffsetHelper` contract in order to retire the specified amount of carbon. This function: 1. Swaps the ERC20 token sent to the contract for the specified pool token. 2. Redeems the pool token for the poorest quality TCO2 tokens available. 3. Retires the TCO2 tokens. Note: The client must approve the ERC20 token that is sent to the contract.\"},\"autoOffsetPoolToken(address,uint256)\":{\"notice\":\"Retire carbon credits using the lowest quality (oldest) TCO2 tokens available by sending Toucan pool tokens, e.g., NCT. This function: 1. Redeems the pool token for the poorest quality TCO2 tokens available. 2. Retires the TCO2 tokens. Note: The client must approve the pool token that is sent.\"},\"autoRedeem(address,uint256)\":{\"notice\":\"Redeems the specified amount of NCT / BCT for TCO2.\"},\"autoRetire(address[],uint256[])\":{\"notice\":\"Retire the specified TCO2 tokens.\"},\"calculateExpectedPoolTokenForETH(address,uint256)\":{\"notice\":\"Calculates the expected amount of Toucan Pool token that can be acquired by swapping the provided amount of native tokens e.g., MATIC.\"},\"calculateExpectedPoolTokenForToken(address,address,uint256)\":{\"notice\":\"Calculates the expected amount of Toucan Pool token that can be acquired by swapping the provided amount of ERC20 token.\"},\"calculateNeededETHAmount(address,uint256)\":{\"notice\":\"Return how much native tokens e.g, MATIC is required in order to swap for the desired amount of a Toucan pool token, e.g., NCT.\"},\"calculateNeededTokenAmount(address,address,uint256)\":{\"notice\":\"Return how much of the specified ERC20 token is required in order to swap for the desired amount of a Toucan pool token, for example, e.g., NCT.\"},\"constructor\":{\"notice\":\"Contract constructor. Should specify arrays of ERC20 symbols and addresses that can used by the contract.\"},\"deposit(address,uint256)\":{\"notice\":\"Allow users to deposit BCT / NCT.\"},\"isERC20AddressEligible(address)\":{\"notice\":\"Checks if ERC20 Token is eligible for swapping.\"},\"isPoolAddressEligible(address)\":{\"notice\":\"Checks if Pool Address is eligible for offsetting.\"},\"removePath(string)\":{\"notice\":\"Delete eligible tokens stored in the contract.\"},\"removePoolToken(address)\":{\"notice\":\"Delete eligible pool token addresses stored in the contract.\"},\"swapExactInETH(address)\":{\"notice\":\"Swap native tokens e.g., MATIC for Toucan pool tokens (BCT/NCT) on SushiSwap. All provided native tokens will be swapped.\"},\"swapExactInToken(address,address,uint256)\":{\"notice\":\"Swap eligible ERC20 tokens for Toucan pool tokens (BCT/NCT) on SushiSwap. All provided ERC20 tokens will be swapped.\"},\"swapExactOutETH(address,uint256)\":{\"notice\":\"Swap native tokens e.g., MATIC for Toucan pool tokens (BCT/NCT) on SushiSwap. Remaining native tokens that was not consumed by the swap is returned.\"},\"swapExactOutToken(address,address,uint256)\":{\"notice\":\"Swap eligible ERC20 tokens for Toucan pool tokens (BCT/NCT) on SushiSwap\"},\"withdraw(address,uint256)\":{\"notice\":\"Allow users to withdraw tokens they have deposited.\"}},\"notice\":\"Helper functions that simplify the carbon offsetting (retirement) process. Retiring carbon tokens requires multiple steps and interactions with Toucan Protocol's main contracts: 1. Obtain a Toucan pool token e.g., NCT (by performing a token swap on a DEX). 2. Redeem the pool token for a TCO2 token. 3. Retire the TCO2 token. These steps are combined in each of the following \\\"auto offset\\\" methods implemented in `OffsetHelper` to allow a retirement within one transaction: - `autoOffsetPoolToken()` if the user already owns a Toucan pool token e.g., NCT, - `autoOffsetExactOutETH()` if the user would like to perform a retirement using native tokens e.g., MATIC, specifying the exact amount of TCO2s to retire (only on Polygon, not on Celo), - `autoOffsetExactInETH()` if the user would like to perform a retirement using native tokens, swapping all sent native tokens into TCO2s (only on Polygon, not on Celo), - `autoOffsetExactOutToken()` if the user would like to perform a retirement using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount of TCO2s to retire, - `autoOffsetExactInToken()` if the user would like to perform a retirement using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount of token to swap into TCO2s. In these methods, \\\"auto\\\" refers to the fact that these methods use `autoRedeem()` in order to automatically choose a TCO2 token corresponding to the oldest tokenized carbon project in the specfified token pool. There are no fees incurred by the user when using `autoRedeem()`, i.e., the user receives 1 TCO2 token for each pool token (BCT/NCT) redeemed. There are two `view` helper functions `calculateNeededETHAmount()` and `calculateNeededTokenAmount()` that should be called before using `autoOffsetExactOutETH()` and `autoOffsetExactOutToken()`, to determine how much native tokens e.g., MATIC, respectively how much of the ERC20 token must be sent to the `OffsetHelper` contract in order to retire the specified amount of carbon. The two `view` helper functions `calculateExpectedPoolTokenForETH()` and `calculateExpectedPoolTokenForToken()` can be used to calculate the expected amount of TCO2s that will be offset using functions `autoOffsetExactInETH()` and `autoOffsetExactInToken()`.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/OffsetHelper.sol\":\"OffsetHelper\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x247c62047745915c0af6b955470a72d1696ebad4352d7d3011aef1a2463cd888\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0xe798cadb41e2da274913e4b3183a80f50fb057a42238fe8467e077268100ec27\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20Upgradeable {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x4e733d3164f73f461eaf9d8087a7ad1ea180bdc8ba0d3d61b0e1ae16d8e63dff\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2edcb41c121abc510932e8d83ff8b82cf9cdde35e7c297622f5c29ef0af25183\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n function safePermit(\\n IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9b72f93be69ca894d8492c244259615c4a742afc8d63720dbc8bb81087d9b238\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721Receiver {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol\":{\"content\":\"pragma solidity >=0.6.2;\\n\\ninterface IUniswapV2Router01 {\\n function factory() external pure returns (address);\\n function WETH() external pure returns (address);\\n\\n function addLiquidity(\\n address tokenA,\\n address tokenB,\\n uint amountADesired,\\n uint amountBDesired,\\n uint amountAMin,\\n uint amountBMin,\\n address to,\\n uint deadline\\n ) external returns (uint amountA, uint amountB, uint liquidity);\\n function addLiquidityETH(\\n address token,\\n uint amountTokenDesired,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline\\n ) external payable returns (uint amountToken, uint amountETH, uint liquidity);\\n function removeLiquidity(\\n address tokenA,\\n address tokenB,\\n uint liquidity,\\n uint amountAMin,\\n uint amountBMin,\\n address to,\\n uint deadline\\n ) external returns (uint amountA, uint amountB);\\n function removeLiquidityETH(\\n address token,\\n uint liquidity,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline\\n ) external returns (uint amountToken, uint amountETH);\\n function removeLiquidityWithPermit(\\n address tokenA,\\n address tokenB,\\n uint liquidity,\\n uint amountAMin,\\n uint amountBMin,\\n address to,\\n uint deadline,\\n bool approveMax, uint8 v, bytes32 r, bytes32 s\\n ) external returns (uint amountA, uint amountB);\\n function removeLiquidityETHWithPermit(\\n address token,\\n uint liquidity,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline,\\n bool approveMax, uint8 v, bytes32 r, bytes32 s\\n ) external returns (uint amountToken, uint amountETH);\\n function swapExactTokensForTokens(\\n uint amountIn,\\n uint amountOutMin,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external returns (uint[] memory amounts);\\n function swapTokensForExactTokens(\\n uint amountOut,\\n uint amountInMax,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external returns (uint[] memory amounts);\\n function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)\\n external\\n payable\\n returns (uint[] memory amounts);\\n function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)\\n external\\n returns (uint[] memory amounts);\\n function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)\\n external\\n returns (uint[] memory amounts);\\n function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)\\n external\\n payable\\n returns (uint[] memory amounts);\\n\\n function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);\\n function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);\\n function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);\\n function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);\\n function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);\\n}\\n\",\"keccak256\":\"0x8a3c5c449d4b7cd76513ed6995f4b86e4a86f222c770f8442f5fc128ce29b4d2\"},\"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\":{\"content\":\"pragma solidity >=0.6.2;\\n\\nimport './IUniswapV2Router01.sol';\\n\\ninterface IUniswapV2Router02 is IUniswapV2Router01 {\\n function removeLiquidityETHSupportingFeeOnTransferTokens(\\n address token,\\n uint liquidity,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline\\n ) external returns (uint amountETH);\\n function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(\\n address token,\\n uint liquidity,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline,\\n bool approveMax, uint8 v, bytes32 r, bytes32 s\\n ) external returns (uint amountETH);\\n\\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\\n uint amountIn,\\n uint amountOutMin,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external;\\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\\n uint amountOutMin,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external payable;\\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\\n uint amountIn,\\n uint amountOutMin,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external;\\n}\\n\",\"keccak256\":\"0x744e30c133bd0f7ca9e7163433cf6d72f45c6bb1508c2c9c02f1a6db796ae59d\"},\"contracts/OffsetHelper.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2022 Toucan Labs\\n// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\\\";\\nimport \\\"./OffsetHelperStorage.sol\\\";\\nimport \\\"./interfaces/IToucanPoolToken.sol\\\";\\nimport \\\"./interfaces/IToucanCarbonOffsets.sol\\\";\\nimport \\\"./interfaces/IToucanContractRegistry.sol\\\";\\n\\n/**\\n * @title Toucan Protocol Offset Helpers\\n * @notice Helper functions that simplify the carbon offsetting (retirement)\\n * process.\\n *\\n * Retiring carbon tokens requires multiple steps and interactions with\\n * Toucan Protocol's main contracts:\\n * 1. Obtain a Toucan pool token e.g., NCT (by performing a token\\n * swap on a DEX).\\n * 2. Redeem the pool token for a TCO2 token.\\n * 3. Retire the TCO2 token.\\n *\\n * These steps are combined in each of the following \\\"auto offset\\\" methods\\n * implemented in `OffsetHelper` to allow a retirement within one transaction:\\n * - `autoOffsetPoolToken()` if the user already owns a Toucan pool\\n * token e.g., NCT,\\n * - `autoOffsetExactOutETH()` if the user would like to perform a retirement\\n * using native tokens e.g., MATIC, specifying the exact amount of TCO2s to retire (only on Polygon, not on Celo),\\n * - `autoOffsetExactInETH()` if the user would like to perform a retirement\\n * using native tokens, swapping all sent native tokens into TCO2s (only on Polygon, not on Celo),\\n * - `autoOffsetExactOutToken()` if the user would like to perform a retirement\\n * using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount\\n * of TCO2s to retire,\\n * - `autoOffsetExactInToken()` if the user would like to perform a retirement\\n * using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount\\n * of token to swap into TCO2s.\\n *\\n * In these methods, \\\"auto\\\" refers to the fact that these methods use\\n * `autoRedeem()` in order to automatically choose a TCO2 token corresponding\\n * to the oldest tokenized carbon project in the specfified token pool.\\n * There are no fees incurred by the user when using `autoRedeem()`, i.e., the\\n * user receives 1 TCO2 token for each pool token (BCT/NCT) redeemed.\\n *\\n * There are two `view` helper functions `calculateNeededETHAmount()` and\\n * `calculateNeededTokenAmount()` that should be called before using\\n * `autoOffsetExactOutETH()` and `autoOffsetExactOutToken()`, to determine how\\n * much native tokens e.g., MATIC, respectively how much of the ERC20 token must be sent to the\\n * `OffsetHelper` contract in order to retire the specified amount of carbon.\\n *\\n * The two `view` helper functions `calculateExpectedPoolTokenForETH()` and\\n * `calculateExpectedPoolTokenForToken()` can be used to calculate the\\n * expected amount of TCO2s that will be offset using functions\\n * `autoOffsetExactInETH()` and `autoOffsetExactInToken()`.\\n */\\ncontract OffsetHelper is OffsetHelperStorage {\\n using SafeERC20 for IERC20;\\n // Chain ID of Celo mainnet\\n uint256 private constant CELO_MAINNET_CHAINID = 42220;\\n\\n /**\\n * @notice Emitted upon successful redemption of TCO2 tokens from a Toucan\\n * pool token e.g., NCT.\\n *\\n * @param sender The sender of the transaction\\n * @param poolToken The address of the Toucan pool token used in the\\n * redemption, e.g., NCT\\n * @param tco2s An array of the TCO2 addresses that were redeemed\\n * @param amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n event Redeemed(\\n address sender,\\n address poolToken,\\n address[] tco2s,\\n uint256[] amounts\\n );\\n\\n modifier onlyRedeemable(address _token) {\\n require(isRedeemable(_token), \\\"Token not redeemable\\\");\\n\\n _;\\n }\\n\\n modifier onlySwappable(address _token) {\\n require(isSwappable(_token), \\\"Path doesn't yet exists.\\\");\\n\\n _;\\n }\\n\\n modifier nativeTokenChain() {\\n require(\\n block.chainid != CELO_MAINNET_CHAINID,\\n \\\"The function is not available on this network.\\\"\\n );\\n\\n _;\\n }\\n\\n /**\\n * @notice Contract constructor. Should specify arrays of ERC20 symbols and\\n * addresses that can used by the contract.\\n *\\n * @dev See `isEligible()` for a list of tokens that can be used in the\\n * contract. These can be modified after deployment by the contract owner\\n * using `setEligibleTokenAddress()` and `deleteEligibleTokenAddress()`.\\n *\\n * @param _poolAddresses A list of pool token addresses.\\n * @param _tokenSymbolsForPaths An array of symbols of the token the user want to retire carbon credits for\\n * @param _paths An array of arrays of addresses to describe the path needed to swap form the baseToken to the pool Token\\n * to the provided token symbols.\\n */\\n constructor(\\n address[] memory _poolAddresses,\\n string[] memory _tokenSymbolsForPaths,\\n address[][] memory _paths,\\n address _dexRouterAddress\\n ) {\\n dexRouterAddress = _dexRouterAddress;\\n poolAddresses = _poolAddresses;\\n tokenSymbolsForPaths = _tokenSymbolsForPaths;\\n paths = _paths;\\n\\n uint256 i = 0;\\n uint256 eligibleSwapPathsBySymbolLen = _tokenSymbolsForPaths.length;\\n while (i < eligibleSwapPathsBySymbolLen) {\\n eligibleSwapPaths[_paths[i][0]] = _paths[i];\\n eligibleSwapPathsBySymbol[_tokenSymbolsForPaths[i]] = _paths[i];\\n i += 1;\\n }\\n }\\n\\n // fallback payable and receive method to fix the situation where transfering dust native tokens\\n // in the native tokens to token swap fails\\n\\n receive() external payable {}\\n\\n fallback() external payable {}\\n\\n // ----------------------------------------\\n // Upgradable related functions\\n // ----------------------------------------\\n\\n function initialize() external virtual initializer {\\n __Ownable_init_unchained();\\n }\\n\\n // ----------------------------------------\\n // Public functions\\n // ----------------------------------------\\n\\n /**\\n * @notice Retire carbon credits using the lowest quality (oldest) TCO2\\n * tokens available from the specified Toucan token pool by sending ERC20\\n * tokens (cUSD, USDC, WETH, WMATIC). The `view` helper function\\n * `calculateNeededTokenAmount()` should be called before using `autoOffsetExactOutToken()`,\\n * to determine how much native tokens e.g., MATIC must be sent to the\\n * `OffsetHelper` contract in order to retire the specified amount of carbon.\\n *\\n * This function:\\n * 1. Swaps the ERC20 token sent to the contract for the specified pool token.\\n * 2. Redeems the pool token for the poorest quality TCO2 tokens available.\\n * 3. Retires the TCO2 tokens.\\n *\\n * Note: The client must approve the ERC20 token that is sent to the contract.\\n *\\n * @dev When automatically redeeming pool tokens for the lowest quality\\n * TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool\\n * token.\\n *\\n * @param _fromToken The address of the ERC20 token that the user sends\\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\\n * @param _poolToken The address of the Toucan pool token that the\\n * user wants to offset, e.g., NCT\\n * @param _amountToOffset The amount of TCO2 to offset\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetExactOutToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _amountToOffset\\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\\n // swap input token for BCT / NCT\\n swapExactOutToken(_fromToken, _poolToken, _amountToOffset);\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire carbon credits using the lowest quality (oldest) TCO2\\n * tokens available from the specified Toucan token pool by sending ERC20\\n * tokens (cUSD, USDC, WETH, WMATIC). All provided token is consumed for\\n * offsetting.\\n *\\n * The `view` helper function `calculateExpectedPoolTokenForToken()`\\n * can be used to calculate the expected amount of TCO2s that will be\\n * offset using `autoOffsetExactInToken()`.\\n *\\n * This function:\\n * 1. Swaps the ERC20 token sent to the contract for the specified pool token.\\n * 2. Redeems the pool token for the poorest quality TCO2 tokens available.\\n * 3. Retires the TCO2 tokens.\\n *\\n * Note: The client must approve the ERC20 token that is sent to the contract.\\n *\\n * @dev When automatically redeeming pool tokens for the lowest quality\\n * TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool\\n * token.\\n *\\n * @param _fromToken The address of the ERC20 token that the user sends\\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\\n * @param _poolToken The address of the pool token to offset,\\n * e.g., NCT\\n * @param _amountToSwap The amount of ERC20 token to swap into Toucan pool\\n * token. Full amount will be used for offsetting.\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetExactInToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _amountToSwap\\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\\n // swap input token for BCT / NCT\\n uint256 amountToOffset = swapExactInToken(\\n _fromToken,\\n _poolToken,\\n _amountToSwap\\n );\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire carbon credits using the lowest quality (oldest) TCO2\\n * tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC.\\n *\\n * The `view` helper function `calculateNeededETHAmount()` should be called before using\\n * `autoOffsetExactOutETH()`, to determine how much native tokens e.g.,\\n * MATIC must be sent to the `OffsetHelper` contract in order to retire\\n * the specified amount of carbon.\\n *\\n * This function:\\n * 1. Swaps the native token e.g. MATIC sent to the contract for the specified pool token.\\n * 2. Redeems the pool token for the poorest quality TCO2 tokens available.\\n * 3. Retires the TCO2 tokens.\\n *\\n * @dev If the user sends too much native tokens , the leftover amount will be sent back\\n * to the user. This function is only available on Polygon, not on Celo.\\n *\\n * @param _poolToken The address of the pool token to offset,\\n * e.g., NCT\\n * @param _amountToOffset The amount of TCO2 to offset.\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetExactOutETH(\\n address _poolToken,\\n uint256 _amountToOffset\\n )\\n public\\n payable\\n nativeTokenChain\\n returns (address[] memory tco2s, uint256[] memory amounts)\\n {\\n // swap native tokens for BCT / NCT\\n swapExactOutETH(_poolToken, _amountToOffset);\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire carbon credits using the lowest quality (oldest) TCO2\\n * tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC.\\n * All provided native tokens is consumed for offsetting.\\n *\\n * The `view` helper function `calculateExpectedPoolTokenForETH()` can be\\n * used to calculate the expected amount of TCO2s that will be offset\\n * using `autoOffsetExactInETH()`.\\n *\\n * This function:\\n * 1. Swaps the native token e.g. MATIC sent to the contract for the specified pool token.\\n * 2. Redeems the pool token for the poorest quality TCO2 tokens available.\\n * 3. Retires the TCO2 tokens.\\n *\\n * @dev This function is only available on Polygon, not on Celo.\\n *\\n * @param _poolToken The address of the pool token to offset,\\n * e.g., NCT\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetExactInETH(\\n address _poolToken\\n )\\n public\\n payable\\n nativeTokenChain\\n returns (address[] memory tco2s, uint256[] memory amounts)\\n {\\n // swap native tokens for BCT / NCT\\n uint256 amountToOffset = swapExactInETH(_poolToken);\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire carbon credits using the lowest quality (oldest) TCO2\\n * tokens available by sending Toucan pool tokens, e.g., NCT.\\n *\\n * This function:\\n * 1. Redeems the pool token for the poorest quality TCO2 tokens available.\\n * 2. Retires the TCO2 tokens.\\n *\\n * Note: The client must approve the pool token that is sent.\\n *\\n * @param _poolToken The address of the pool token to offset,\\n * e.g., NCT\\n * @param _amountToOffset The amount of TCO2 to offset.\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetPoolToken(\\n address _poolToken,\\n uint256 _amountToOffset\\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\\n // deposit pool token from user to this contract\\n deposit(_poolToken, _amountToOffset);\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Swap eligible ERC20 tokens for Toucan pool tokens (BCT/NCT) on SushiSwap\\n * @dev Needs to be approved on the client side\\n * @param _fromToken The address of the ERC20 token used for the swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _toAmount The required amount of the Toucan pool token (NCT/BCT)\\n */\\n function swapExactOutToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _toAmount\\n ) public onlySwappable(_fromToken) onlyRedeemable(_poolToken) {\\n // calculate path & amounts\\n (\\n address[] memory path,\\n uint256[] memory expAmounts\\n ) = calculateExactOutSwap(_fromToken, _poolToken, _toAmount);\\n uint256 amountIn = expAmounts[0];\\n\\n // transfer tokens\\n IERC20(_fromToken).safeTransferFrom(\\n msg.sender,\\n address(this),\\n amountIn\\n );\\n\\n // approve router\\n IERC20(_fromToken).approve(dexRouterAddress, amountIn);\\n\\n // swap\\n uint256[] memory amounts = dexRouter().swapTokensForExactTokens(\\n _toAmount,\\n amountIn, // max. input amount\\n path,\\n address(this),\\n block.timestamp\\n );\\n\\n // remove remaining approval if less input token was consumed\\n if (amounts[0] < amountIn) {\\n IERC20(_fromToken).approve(dexRouterAddress, 0);\\n }\\n\\n // update balances\\n balances[msg.sender][_poolToken] += _toAmount;\\n }\\n\\n /**\\n * @notice Swap eligible ERC20 tokens for Toucan pool tokens (BCT/NCT) on\\n * SushiSwap. All provided ERC20 tokens will be swapped.\\n * @dev Needs to be approved on the client side.\\n * @param _fromToken The address of the ERC20 token used for the swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _fromAmount The amount of ERC20 token to swap\\n * @return amountOut Resulting amount of Toucan pool token that got acquired for the\\n * swapped ERC20 tokens.\\n */\\n function swapExactInToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _fromAmount\\n )\\n public\\n onlySwappable(_fromToken)\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountOut)\\n {\\n // calculate path & amounts\\n\\n address[] memory path = generatePath(_fromToken, _poolToken);\\n\\n uint256 len = path.length;\\n\\n // transfer tokens\\n IERC20(_fromToken).safeTransferFrom(\\n msg.sender,\\n address(this),\\n _fromAmount\\n );\\n\\n // approve router\\n IERC20(_fromToken).safeApprove(dexRouterAddress, _fromAmount);\\n\\n // swap\\n uint256[] memory amounts = dexRouter().swapExactTokensForTokens(\\n _fromAmount,\\n 0, // min. output amount\\n path,\\n address(this),\\n block.timestamp\\n );\\n amountOut = amounts[len - 1];\\n\\n // update balances\\n balances[msg.sender][_poolToken] += amountOut;\\n }\\n\\n /**\\n * @notice Swap native tokens e.g., MATIC for Toucan pool tokens (BCT/NCT) on SushiSwap.\\n * Remaining native tokens that was not consumed by the swap is returned.\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _toAmount The required amount of the Toucan pool token (NCT/BCT)\\n */\\n function swapExactOutETH(\\n address _poolToken,\\n uint256 _toAmount\\n ) public payable nativeTokenChain onlyRedeemable(_poolToken) {\\n // create path & amounts\\n // wrap the native token\\n address fromToken = eligibleSwapPathsBySymbol[\\\"WMATIC\\\"][0];\\n address[] memory path = generatePath(fromToken, _poolToken);\\n\\n // swap\\n uint256[] memory amounts = dexRouter().swapETHForExactTokens{\\n value: msg.value\\n }(_toAmount, path, address(this), block.timestamp);\\n\\n // send surplus back\\n if (msg.value > amounts[0]) {\\n uint256 leftoverETH = msg.value - amounts[0];\\n (bool success, ) = msg.sender.call{value: leftoverETH}(\\n new bytes(0)\\n );\\n\\n require(success, \\\"Failed to send surplus back\\\");\\n }\\n\\n // update balances\\n balances[msg.sender][_poolToken] += _toAmount;\\n }\\n\\n /**\\n * @notice Swap native tokens e.g., MATIC for Toucan pool tokens (BCT/NCT) on SushiSwap. All\\n * provided native tokens will be swapped.\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @return amountOut Resulting amount of Toucan pool token that got acquired for the\\n * swapped native tokens .\\n */\\n function swapExactInETH(\\n address _poolToken\\n )\\n public\\n payable\\n nativeTokenChain\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountOut)\\n {\\n // create path & amounts\\n uint256 fromAmount = msg.value;\\n // wrap the native token\\n address fromToken = eligibleSwapPathsBySymbol[\\\"WMATIC\\\"][0];\\n address[] memory path = generatePath(fromToken, _poolToken);\\n\\n uint256 len = path.length;\\n\\n // swap\\n uint256[] memory amounts = dexRouter().swapExactETHForTokens{\\n value: fromAmount\\n }(0, path, address(this), block.timestamp);\\n amountOut = amounts[len - 1];\\n\\n // update balances\\n balances[msg.sender][_poolToken] += amountOut;\\n }\\n\\n /**\\n * @notice Allow users to withdraw tokens they have deposited.\\n */\\n function withdraw(address _erc20Addr, uint256 _amount) public {\\n require(\\n balances[msg.sender][_erc20Addr] >= _amount,\\n \\\"Insufficient balance\\\"\\n );\\n\\n IERC20(_erc20Addr).safeTransfer(msg.sender, _amount);\\n balances[msg.sender][_erc20Addr] -= _amount;\\n }\\n\\n /**\\n * @notice Allow users to deposit BCT / NCT.\\n * @dev Needs to be approved\\n */\\n function deposit(\\n address _erc20Addr,\\n uint256 _amount\\n ) public onlyRedeemable(_erc20Addr) {\\n IERC20(_erc20Addr).safeTransferFrom(msg.sender, address(this), _amount);\\n balances[msg.sender][_erc20Addr] += _amount;\\n }\\n\\n /**\\n * @notice Redeems the specified amount of NCT / BCT for TCO2.\\n * @dev Needs to be approved on the client side\\n * @param _fromToken Could be the address of NCT\\n * @param _amount Amount to redeem\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoRedeem(\\n address _fromToken,\\n uint256 _amount\\n )\\n public\\n onlyRedeemable(_fromToken)\\n returns (address[] memory tco2s, uint256[] memory amounts)\\n {\\n require(\\n balances[msg.sender][_fromToken] >= _amount,\\n \\\"Insufficient NCT/BCT balance\\\"\\n );\\n\\n // instantiate pool token (NCT)\\n IToucanPoolToken PoolTokenImplementation = IToucanPoolToken(_fromToken);\\n\\n // auto redeem pool token for TCO2; will transfer automatically picked TCO2 to this contract\\n (tco2s, amounts) = PoolTokenImplementation.redeemAuto2(_amount);\\n\\n // update balances\\n balances[msg.sender][_fromToken] -= _amount;\\n uint256 tco2sLen = tco2s.length;\\n for (uint256 index = 0; index < tco2sLen; index++) {\\n balances[msg.sender][tco2s[index]] += amounts[index];\\n }\\n\\n emit Redeemed(msg.sender, _fromToken, tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire the specified TCO2 tokens.\\n * @param _tco2s The addresses of the TCO2s to retire\\n * @param _amounts The amounts to retire from each of the corresponding\\n * TCO2 addresses\\n */\\n function autoRetire(\\n address[] memory _tco2s,\\n uint256[] memory _amounts\\n ) public {\\n uint256 tco2sLen = _tco2s.length;\\n require(tco2sLen != 0, \\\"Array empty\\\");\\n\\n require(tco2sLen == _amounts.length, \\\"Arrays unequal\\\");\\n\\n uint256 i = 0;\\n while (i < tco2sLen) {\\n if (_amounts[i] == 0) {\\n unchecked {\\n i++;\\n }\\n continue;\\n }\\n require(\\n balances[msg.sender][_tco2s[i]] >= _amounts[i],\\n \\\"Insufficient TCO2 balance\\\"\\n );\\n\\n balances[msg.sender][_tco2s[i]] -= _amounts[i];\\n\\n IToucanCarbonOffsets(_tco2s[i]).retire(_amounts[i]);\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n // ----------------------------------------\\n // Public view functions\\n // ----------------------------------------\\n\\n /**\\n * @notice Return how much of the specified ERC20 token is required in\\n * order to swap for the desired amount of a Toucan pool token, for\\n * example, e.g., NCT.\\n *\\n * @param _fromToken The address of the ERC20 token used for the swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _toAmount The desired amount of pool token to receive\\n * @return amountIn The amount of the ERC20 token required in order to\\n * swap for the specified amount of the pool token\\n */\\n function calculateNeededTokenAmount(\\n address _fromToken,\\n address _poolToken,\\n uint256 _toAmount\\n )\\n public\\n view\\n onlySwappable(_fromToken)\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountIn)\\n {\\n (, uint256[] memory amounts) = calculateExactOutSwap(\\n _fromToken,\\n _poolToken,\\n _toAmount\\n );\\n amountIn = amounts[0];\\n }\\n\\n /**\\n * @notice Calculates the expected amount of Toucan Pool token that can be\\n * acquired by swapping the provided amount of ERC20 token.\\n *\\n * @param _fromToken The address of the ERC20 token used for the swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _fromAmount The amount of ERC20 token to swap\\n * @return amountOut The expected amount of Pool token that can be acquired\\n */\\n function calculateExpectedPoolTokenForToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _fromAmount\\n )\\n public\\n view\\n onlySwappable(_fromToken)\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountOut)\\n {\\n (, uint256[] memory amounts) = calculateExactInSwap(\\n _fromToken,\\n _poolToken,\\n _fromAmount\\n );\\n amountOut = amounts[amounts.length - 1];\\n }\\n\\n /**\\n * @notice Return how much native tokens e.g, MATIC is required in order to swap for the\\n * desired amount of a Toucan pool token, e.g., NCT.\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _toAmount The desired amount of pool token to receive\\n * @return amountIn The amount of native tokens required in order to swap for\\n * the specified amount of the pool token\\n */\\n function calculateNeededETHAmount(\\n address _poolToken,\\n uint256 _toAmount\\n )\\n public\\n view\\n nativeTokenChain\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountIn)\\n {\\n address fromToken = eligibleSwapPathsBySymbol[\\\"WMATIC\\\"][0];\\n (, uint256[] memory amounts) = calculateExactOutSwap(\\n fromToken,\\n _poolToken,\\n _toAmount\\n );\\n amountIn = amounts[0];\\n }\\n\\n /**\\n * @notice Calculates the expected amount of Toucan Pool token that can be\\n * acquired by swapping the provided amount of native tokens e.g., MATIC.\\n *\\n * @param _fromTokenAmount The amount of native tokens to swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @return amountOut The expected amount of Pool token that can be acquired\\n */\\n function calculateExpectedPoolTokenForETH(\\n address _poolToken,\\n uint256 _fromTokenAmount\\n )\\n public\\n view\\n nativeTokenChain\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountOut)\\n {\\n address fromToken = eligibleSwapPathsBySymbol[\\\"WMATIC\\\"][0];\\n (, uint256[] memory amounts) = calculateExactInSwap(\\n fromToken,\\n _poolToken,\\n _fromTokenAmount\\n );\\n amountOut = amounts[amounts.length - 1];\\n }\\n\\n /**\\n * @notice Checks if Pool Address is eligible for offsetting.\\n * @param _poolToken The address of the pool token to offset,\\n * e.g., NCT\\n * @return _isEligible Returns a bool if the Pool token is eligible for offsetting\\n */\\n function isPoolAddressEligible(\\n address _poolToken\\n ) public view returns (bool _isEligible) {\\n _isEligible = isRedeemable(_poolToken);\\n }\\n\\n /**\\n * @notice Checks if ERC20 Token is eligible for swapping.\\n * @param _erc20Address The address of the ERC20 token that the user sends\\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\\n * @return _path Returns the path of the token to be exchanged\\n */\\n function isERC20AddressEligible(\\n address _erc20Address\\n ) public view returns (address[] memory _path) {\\n _path = eligibleSwapPaths[_erc20Address];\\n }\\n\\n // ----------------------------------------\\n // Internal methods\\n // ----------------------------------------\\n\\n function calculateExactOutSwap(\\n address _fromToken,\\n address _poolToken,\\n uint256 _toAmount\\n ) internal view returns (address[] memory path, uint256[] memory amounts) {\\n // create path & calculate amounts\\n path = generatePath(_fromToken, _poolToken);\\n uint256 len = path.length;\\n\\n amounts = dexRouter().getAmountsIn(_toAmount, path);\\n\\n // sanity check arrays\\n require(len == amounts.length, \\\"Arrays unequal\\\");\\n require(_toAmount == amounts[len - 1], \\\"Output amount mismatch\\\");\\n }\\n\\n function calculateExactInSwap(\\n address _fromToken,\\n address _poolToken,\\n uint256 _fromAmount\\n ) internal view returns (address[] memory path, uint256[] memory amounts) {\\n // create path & calculate amounts\\n path = generatePath(_fromToken, _poolToken);\\n uint256 len = path.length;\\n\\n amounts = dexRouter().getAmountsOut(_fromAmount, path);\\n\\n // sanity check arrays\\n require(len == amounts.length, \\\"Arrays unequal\\\");\\n require(_fromAmount == amounts[0], \\\"Input amount mismatch\\\");\\n }\\n\\n /**\\n * @notice Show all pool token addresses that can be used to retired.\\n * @param _fromToken a list of token symbols that can be retired.\\n * @param _toToken a list of token symbols that can be retired.\\n */\\n function generatePath(\\n address _fromToken,\\n address _toToken\\n ) internal view returns (address[] memory path) {\\n uint256 len = eligibleSwapPaths[_fromToken].length;\\n if (len == 1) {\\n path = new address[](2);\\n path[0] = _fromToken;\\n path[1] = _toToken;\\n return path;\\n }\\n if (len == 2) {\\n path = new address[](3);\\n path[0] = _fromToken;\\n path[1] = eligibleSwapPaths[_fromToken][1];\\n path[2] = _toToken;\\n return path;\\n }\\n if (len == 3) {\\n path = new address[](3);\\n path[0] = _fromToken;\\n path[1] = eligibleSwapPaths[_fromToken][1];\\n path[2] = eligibleSwapPaths[_fromToken][2];\\n path[3] = _toToken;\\n return path;\\n } else {\\n path = new address[](4);\\n path[0] = _fromToken;\\n path[1] = eligibleSwapPaths[_fromToken][1];\\n path[2] = eligibleSwapPaths[_fromToken][2];\\n path[3] = eligibleSwapPaths[_fromToken][3];\\n path[4] = _toToken;\\n return path;\\n }\\n }\\n\\n function dexRouter() internal view returns (IUniswapV2Router02) {\\n return IUniswapV2Router02(dexRouterAddress);\\n }\\n\\n /**\\n * @notice Checks whether an address is a Toucan pool token address\\n * @param _erc20Address address of token to be checked\\n * @return True if the address is a Toucan pool token address\\n */\\n function isRedeemable(address _erc20Address) private view returns (bool) {\\n for (uint i = 0; i < poolAddresses.length; i++) {\\n if (poolAddresses[i] == _erc20Address) {\\n return true;\\n }\\n }\\n\\n return false;\\n }\\n\\n /**\\n * @notice Checks whether an address can be used in a token swap\\n * @param _erc20Address address of token to be checked\\n * @return True if the specified address can be used in a swap\\n */\\n function isSwappable(address _erc20Address) private view returns (bool) {\\n for (uint i = 0; i < paths.length; i++) {\\n if (paths[i][0] == _erc20Address) {\\n return true;\\n }\\n }\\n\\n return false;\\n }\\n\\n /**\\n * @notice Cheks if Pool Token is eligible for Offsetting.\\n * @param _poolToken The addresses of the pool token to redeem\\n * @return _isEligible Returns if token can be redeemed\\n */\\n\\n // ----------------------------------------\\n // Admin methods\\n // ----------------------------------------\\n\\n /**\\n * @notice Change or add eligible paths and their addresses.\\n * @param _tokenSymbol The symbol of the token to add\\n * @param _path The path of the path to add\\n */\\n function addPath(\\n string memory _tokenSymbol,\\n address[] memory _path\\n ) public virtual onlyOwner {\\n eligibleSwapPaths[_path[0]] = _path;\\n eligibleSwapPathsBySymbol[_tokenSymbol] = _path;\\n tokenSymbolsForPaths.push(_tokenSymbol);\\n }\\n\\n /**\\n * @notice Delete eligible tokens stored in the contract.\\n * @param _tokenSymbol The symbol of the path to remove\\n */\\n function removePath(string memory _tokenSymbol) public virtual onlyOwner {\\n delete eligibleSwapPaths[eligibleSwapPathsBySymbol[_tokenSymbol][0]];\\n delete eligibleSwapPathsBySymbol[_tokenSymbol];\\n }\\n\\n /**\\n * @notice Change or add pool token addresses.\\n * @param _poolToken The address of the pool token to add\\n */\\n function addPoolToken(address _poolToken) public virtual onlyOwner {\\n poolAddresses.push(_poolToken);\\n }\\n\\n /**\\n * @notice Delete eligible pool token addresses stored in the contract.\\n * @param _poolToken The address of the pool token to remove\\n */\\n function removePoolToken(address _poolToken) public virtual onlyOwner {\\n for (uint256 i; i < poolAddresses.length; i++) {\\n if (poolAddresses[i] == _poolToken) {\\n poolAddresses[i] = poolAddresses[poolAddresses.length - 1];\\n poolAddresses.pop();\\n break;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x00812c8474fe0303b130513d22e4a8cf4866cb16c3a5099203ef3fd769dc1f8a\",\"license\":\"GPL-3.0\"},\"contracts/OffsetHelperStorage.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2022 Toucan Labs\\n//\\n// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\n\\ncontract OffsetHelperStorage is OwnableUpgradeable {\\n // token symbol => token address\\n mapping(address => address[]) public eligibleSwapPaths;\\n mapping(string => address[]) public eligibleSwapPathsBySymbol;\\n\\n address public dexRouterAddress;\\n\\n address[] public poolAddresses;\\n string[] public tokenSymbolsForPaths;\\n address[][] public paths;\\n\\n // user => (token => amount)\\n mapping(address => mapping(address => uint256)) public balances;\\n}\\n\",\"keccak256\":\"0xd505f00a17446ca29983779a8febff10114173db7f47ca4300d6a0bfce6b957a\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IToucanCarbonOffsets.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\\\";\\n\\nimport \\\"../types/CarbonProjectTypes.sol\\\";\\nimport \\\"../types/CarbonProjectVintageTypes.sol\\\";\\n\\ninterface IToucanCarbonOffsets is IERC20Upgradeable, IERC721Receiver {\\n function getGlobalProjectVintageIdentifiers()\\n external\\n view\\n returns (string memory, string memory);\\n\\n function getAttributes()\\n external\\n view\\n returns (ProjectData memory, VintageData memory);\\n\\n function getRemaining() external view returns (uint256 remaining);\\n\\n function getDepositCap() external view returns (uint256);\\n\\n function retire(uint256 amount) external;\\n\\n function retireFrom(address account, uint256 amount) external;\\n\\n function mintCertificateLegacy(\\n string calldata retiringEntityString,\\n address beneficiary,\\n string calldata beneficiaryString,\\n string calldata retirementMessage,\\n uint256 amount\\n ) external;\\n\\n function retireAndMintCertificate(\\n string calldata retiringEntityString,\\n address beneficiary,\\n string calldata beneficiaryString,\\n string calldata retirementMessage,\\n uint256 amount\\n ) external;\\n}\\n\",\"keccak256\":\"0x46c4ed2acd84764d0dd68c9c475e2c6ec3229a686046db48aca77ccd298d4b48\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/IToucanContractRegistry.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\npragma solidity ^0.8.0;\\n\\ninterface IToucanContractRegistry {\\n function carbonOffsetBatchesAddress() external view returns (address);\\n\\n function carbonProjectsAddress() external view returns (address);\\n\\n function carbonProjectVintagesAddress() external view returns (address);\\n\\n function toucanCarbonOffsetsFactoryAddress()\\n external\\n view\\n returns (address);\\n\\n function carbonOffsetBadgesAddress() external view returns (address);\\n\\n function checkERC20(address _address) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xa8451ff2527948e4eed26e97247b979212ccb3bd89506302b6c09ddbad392035\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/IToucanPoolToken.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\n\\ninterface IToucanPoolToken is IERC20Upgradeable {\\n function deposit(address erc20Addr, uint256 amount) external;\\n\\n function checkEligible(address erc20Addr) external view returns (bool);\\n\\n function checkAttributeMatching(address erc20Addr)\\n external\\n view\\n returns (bool);\\n\\n function calculateRedeemFees(\\n address[] memory tco2s,\\n uint256[] memory amounts\\n ) external view returns (uint256);\\n\\n function redeemMany(address[] memory tco2s, uint256[] memory amounts)\\n external;\\n\\n function redeemAuto(uint256 amount) external;\\n\\n function redeemAuto2(uint256 amount)\\n external\\n returns (address[] memory tco2s, uint256[] memory amounts);\\n\\n function getRemaining() external view returns (uint256);\\n\\n function getScoredTCO2s() external view returns (address[] memory);\\n}\\n\",\"keccak256\":\"0xef39949a81cf4ed78d789a1aac5c5860de1582be70de7435f1671931091d43a7\",\"license\":\"UNLICENSED\"},\"contracts/types/CarbonProjectTypes.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @dev CarbonProject related data and attributes\\nstruct ProjectData {\\n string projectId;\\n string standard;\\n string methodology;\\n string region;\\n string storageMethod;\\n string method;\\n string emissionType;\\n string category;\\n string uri;\\n address controller;\\n}\\n\",\"keccak256\":\"0x10d52f79d4bb8dbfe0abbb1662059d6d0193fe5794977b66aacf741451e25401\",\"license\":\"UNLICENSED\"},\"contracts/types/CarbonProjectVintageTypes.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\nstruct VintageData {\\n /// @dev A human-readable string which differentiates this from other vintages in\\n /// the same project, and helps build the corresponding TCO2 name and symbol.\\n string name;\\n uint64 startTime; // UNIX timestamp\\n uint64 endTime; // UNIX timestamp\\n uint256 projectTokenId;\\n uint64 totalVintageQuantity;\\n bool isCorsiaCompliant;\\n bool isCCPcompliant;\\n string coBenefits;\\n string correspAdjustment;\\n string additionalCertification;\\n string uri;\\n}\\n\",\"keccak256\":\"0x3a52e88a48b87f1ca3992c201f8b786ccf3aeb74796510893f8e33b33eae251b\",\"license\":\"UNLICENSED\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506040516200416338038062004163833981016040819052620000349162000585565b606780546001600160a01b0319166001600160a01b038316179055835162000064906068906020870190620001fd565b5082516200007a90606990602086019062000267565b5081516200009090606a906020850190620002c7565b5082516000905b80821015620001f157838281518110620000c157634e487b7160e01b600052603260045260246000fd5b602002602001015160656000868581518110620000ee57634e487b7160e01b600052603260045260246000fd5b60200260200101516000815181106200011757634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020908051906020019062000154929190620001fd565b508382815181106200017657634e487b7160e01b600052603260045260246000fd5b60200260200101516066868481518110620001a157634e487b7160e01b600052603260045260246000fd5b6020026020010151604051620001b89190620006fc565b90815260200160405180910390209080519060200190620001db929190620001fd565b50620001e960018362000773565b915062000097565b5050505050506200081e565b82805482825590600052602060002090810192821562000255579160200282015b828111156200025557825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906200021e565b506200026392915062000327565b5090565b828054828255906000526020600020908101928215620002b9579160200282015b82811115620002b95782518051620002a89184916020909101906200033e565b509160200191906001019062000288565b5062000263929150620003bb565b82805482825590600052602060002090810192821562000319579160200282015b8281111562000319578251805162000308918491602090910190620001fd565b5091602001919060010190620002e8565b5062000263929150620003dc565b5b8082111562000263576000815560010162000328565b8280546200034c90620007cb565b90600052602060002090601f01602090048101928262000370576000855562000255565b82601f106200038b57805160ff191683800117855562000255565b8280016001018555821562000255579182015b82811115620002555782518255916020019190600101906200039e565b8082111562000263576000620003d28282620003fd565b50600101620003bb565b8082111562000263576000620003f382826200043f565b50600101620003dc565b5080546200040b90620007cb565b6000825580601f106200041c575050565b601f0160209004906000526020600020908101906200043c919062000327565b50565b50805460008255906000526020600020908101906200043c919062000327565b80516001600160a01b03811681146200047757600080fd5b919050565b600082601f8301126200048d578081fd5b81516020620004a6620004a0836200074d565b6200071a565b80838252828201915082860187848660051b8901011115620004c6578586fd5b855b85811015620004ef57620004dc826200045f565b84529284019290840190600101620004c8565b5090979650505050505050565b600082601f8301126200050d578081fd5b8151602062000520620004a0836200074d565b80838252828201915082860187848660051b890101111562000540578586fd5b855b85811015620004ef5781516001600160401b0381111562000561578788fd5b620005718a87838c01016200047c565b855250928401929084019060010162000542565b600080600080608085870312156200059b578384fd5b84516001600160401b0380821115620005b2578586fd5b620005c0888389016200047c565b95506020870151915080821115620005d6578485fd5b818701915087601f830112620005ea578485fd5b8151620005fb620004a0826200074d565b80828252602082019150602085018b60208560051b88010111156200061e578889fd5b885b84811015620006b65781518681111562000638578a8bfd5b8701603f81018e1362000649578a8bfd5b60208101518781111562000661576200066162000808565b62000676601f8201601f19166020016200071a565b8181528f60408385010111156200068b578c8dfd5b6200069e82602083016040860162000798565b86525050602093840193919091019060010162000620565b505060408a01519097509350505080821115620006d1578384fd5b50620006e087828801620004fc565b925050620006f1606086016200045f565b905092959194509250565b600082516200071081846020870162000798565b9190910192915050565b604051601f8201601f191681016001600160401b038111828210171562000745576200074562000808565b604052919050565b60006001600160401b0382111562000769576200076962000808565b5060051b60200190565b600082198211156200079357634e487b7160e01b81526011600452602481fd5b500190565b60005b83811015620007b55781810151838201526020016200079b565b83811115620007c5576000848401525b50505050565b600181811c90821680620007e057607f821691505b602082108114156200080257634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b613935806200082e6000396000f3fe6080604052600436106101e55760003560e01c80638da5cb5b11610101578063c23f001f1161009a578063e7f67fb11161006c578063e7f67fb1146105ca578063f04ad9d7146105ea578063f2fde38b146105fd578063f3fef3a31461061d578063feb21b9c1461063d57005b8063c23f001f1461053f578063c6c53efb14610577578063d08ec47514610597578063d8a90c40146105b757005b8063a2844a86116100d3578063a2844a86146104af578063b4e76a86146104df578063b8baf9db146104ff578063c0681c3d1461051f57005b80638da5cb5b146104315780639753209d1461044f578063a09457221461046f578063a0cd60491461048f57005b80635367cd9c1161017e578063715018a611610150578063715018a6146103a757806373200b11146103bc5780638129fc1c146103dc57806382155e7e146103f15780638474c2881461041157005b80635367cd9c1461031a57806356a7de0d1461032d57806368d306d91461034d5780636d4565041461037a57005b80632e98c814116101b75780632e98c8141461029957806335bab7e5146102ba57806347e7ef24146102da5780634865b2b4146102fa57005b80631109ec99146101ee5780631357b113146102215780631661f818146102595780631a0fdecc1461027957005b366101ec57005b005b3480156101fa57600080fd5b5061020e6102093660046131f5565b61065d565b6040519081526020015b60405180910390f35b34801561022d57600080fd5b5061024161023c3660046131f5565b610753565b6040516001600160a01b039091168152602001610218565b34801561026557600080fd5b506101ec610274366004613220565b61078b565b34801561028557600080fd5b5061020e6102943660046131b5565b610a7d565b6102ac6102a73660046131f5565b610b10565b6040516102189291906135f2565b3480156102c657600080fd5b5061020e6102d53660046131b5565b610b5f565b3480156102e657600080fd5b506101ec6102f53660046131f5565b610d0a565b34801561030657600080fd5b5061020e6103153660046131b5565b610d82565b6101ec6103283660046131f5565b610e0d565b34801561033957600080fd5b506101ec61034836600461315a565b6110bd565b34801561035957600080fd5b5061036d61036836600461315a565b611209565b60405161021891906135df565b34801561038657600080fd5b5061039a6103953660046134c2565b61127f565b6040516102189190613655565b3480156103b357600080fd5b506101ec61132b565b3480156103c857600080fd5b506102416103d736600461347f565b61133f565b3480156103e857600080fd5b506101ec61136a565b3480156103fd57600080fd5b506102ac61040c3660046131f5565b61147b565b34801561041d57600080fd5b506101ec61042c3660046131b5565b6116e7565b34801561043d57600080fd5b506033546001600160a01b0316610241565b34801561045b57600080fd5b506101ec61046a3660046133f5565b6119ab565b34801561047b57600080fd5b506102ac61048a3660046131b5565b611a4c565b34801561049b57600080fd5b506102ac6104aa3660046131b5565b611a80565b3480156104bb57600080fd5b506104cf6104ca36600461315a565b611aaf565b6040519015158152602001610218565b3480156104eb57600080fd5b5061020e6104fa3660046131f5565b611ac0565b34801561050b57600080fd5b506101ec61051a366004613428565b611ba6565b34801561052b57600080fd5b506101ec61053a36600461315a565b611c8b565b34801561054b57600080fd5b5061020e61055a36600461317d565b606b60209081526000928352604080842090915290825290205481565b34801561058357600080fd5b506102416105923660046134f2565b611ce5565b3480156105a357600080fd5b506102ac6105b23660046131f5565b611d0d565b61020e6105c536600461315a565b611d1a565b3480156105d657600080fd5b50606754610241906001600160a01b031681565b6102ac6105f836600461315a565b611eec565b34801561060957600080fd5b506101ec61061836600461315a565b611f3d565b34801561062957600080fd5b506101ec6106383660046131f5565b611fb3565b34801561064957600080fd5b506102416106583660046134c2565b61206d565b600061a4ec46141561068a5760405162461bcd60e51b815260040161068190613688565b60405180910390fd5b8261069481612097565b6106b05760405162461bcd60e51b81526004016106819061370d565b600060666040516106cd9065574d4154494360d01b815260060190565b90815260200160405180910390206000815481106106fb57634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b0316915061071c82878761210f565b9150508060008151811061074057634e487b7160e01b600052603260045260246000fd5b6020026020010151935050505092915050565b6065602052816000526040600020818154811061076f57600080fd5b6000918252602090912001546001600160a01b03169150829050565b8151806107c85760405162461bcd60e51b815260206004820152600b60248201526a417272617920656d70747960a81b6044820152606401610681565b815181146107e85760405162461bcd60e51b81526004016106819061373b565b60005b81811015610a775782818151811061081357634e487b7160e01b600052603260045260246000fd5b60200260200101516000141561082b576001016107eb565b82818151811061084b57634e487b7160e01b600052603260045260246000fd5b6020026020010151606b6000336001600160a01b03166001600160a01b03168152602001908152602001600020600086848151811061089a57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000205410156109115760405162461bcd60e51b815260206004820152601960248201527f496e73756666696369656e742054434f322062616c616e6365000000000000006044820152606401610681565b82818151811061093157634e487b7160e01b600052603260045260246000fd5b6020026020010151606b6000336001600160a01b03166001600160a01b03168152602001908152602001600020600086848151811061098057634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060008282546109b79190613825565b925050819055508381815181106109de57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316633790cf57848381518110610a1457634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b8152600401610a3a91815260200190565b600060405180830381600087803b158015610a5457600080fd5b505af1158015610a68573d6000803e3d6000fd5b505050508060010190506107eb565b50505050565b600083610a898161224f565b610aa55760405162461bcd60e51b8152600401610681906136d6565b83610aaf81612097565b610acb5760405162461bcd60e51b81526004016106819061370d565b6000610ad887878761210f565b91505080600081518110610afc57634e487b7160e01b600052603260045260246000fd5b602002602001015193505050509392505050565b60608061a4ec461415610b355760405162461bcd60e51b815260040161068190613688565b610b3f8484610e0d565b610b49848461147b565b9092509050610b58828261078b565b9250929050565b600083610b6b8161224f565b610b875760405162461bcd60e51b8152600401610681906136d6565b83610b9181612097565b610bad5760405162461bcd60e51b81526004016106819061370d565b6000610bb987876122e8565b8051909150610bd36001600160a01b03891633308961289a565b606754610bed906001600160a01b038a8116911688612905565b6000610c016067546001600160a01b031690565b6001600160a01b03166338ed17398860008630426040518663ffffffff1660e01b8152600401610c3595949392919061377c565b600060405180830381600087803b158015610c4f57600080fd5b505af1158015610c63573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c8b91908101906133a2565b905080610c99600184613825565b81518110610cb757634e487b7160e01b600052603260045260246000fd5b602090810291909101810151336000908152606b835260408082206001600160a01b038d168352909352918220805491985088929091610cf890849061380d565b90915550959998505050505050505050565b81610d1481612097565b610d305760405162461bcd60e51b81526004016106819061370d565b610d456001600160a01b03841633308561289a565b336000908152606b602090815260408083206001600160a01b038716845290915281208054849290610d7890849061380d565b9091555050505050565b600083610d8e8161224f565b610daa5760405162461bcd60e51b8152600401610681906136d6565b83610db481612097565b610dd05760405162461bcd60e51b81526004016106819061370d565b6000610ddd878787612a29565b9150508060018251610def9190613825565b81518110610afc57634e487b7160e01b600052603260045260246000fd5b61a4ec461415610e2f5760405162461bcd60e51b815260040161068190613688565b81610e3981612097565b610e555760405162461bcd60e51b81526004016106819061370d565b60006066604051610e729065574d4154494360d01b815260060190565b9081526020016040518091039020600081548110610ea057634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b03169150610ec082866122e8565b90506000610ed66067546001600160a01b031690565b6001600160a01b031663fb3bdb4134878530426040518663ffffffff1660e01b8152600401610f089493929190613620565b6000604051808303818588803b158015610f2157600080fd5b505af1158015610f35573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052610f5e91908101906133a2565b905080600081518110610f8157634e487b7160e01b600052603260045260246000fd5b602002602001015134111561107d57600081600081518110610fb357634e487b7160e01b600052603260045260246000fd5b602002602001015134610fc69190613825565b604080516000808252602082019283905292935033918491610fe791613585565b60006040518083038185875af1925050503d8060008114611024576040519150601f19603f3d011682016040523d82523d6000602084013e611029565b606091505b505090508061107a5760405162461bcd60e51b815260206004820152601b60248201527f4661696c656420746f2073656e6420737572706c7573206261636b00000000006044820152606401610681565b50505b336000908152606b602090815260408083206001600160a01b038a168452909152812080548792906110b090849061380d565b9091555050505050505050565b6110c5612b5f565b60005b60685481101561120557816001600160a01b0316606882815481106110fd57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156111f3576068805461112890600190613825565b8154811061114657634e487b7160e01b600052603260045260246000fd5b600091825260209091200154606880546001600160a01b03909216918390811061118057634e487b7160e01b600052603260045260246000fd5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060688054806111cd57634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b03191690550190555050565b806111fd816138a3565b9150506110c8565b5050565b6001600160a01b03811660009081526065602090815260409182902080548351818402810184019094528084526060939283018282801561127357602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611255575b50505050509050919050565b6069818154811061128f57600080fd5b9060005260206000200160009150905080546112aa90613868565b80601f01602080910402602001604051908101604052809291908181526020018280546112d690613868565b80156113235780601f106112f857610100808354040283529160200191611323565b820191906000526020600020905b81548152906001019060200180831161130657829003601f168201915b505050505081565b611333612b5f565b61133d6000612bb9565b565b8151602081840181018051606682529282019185019190912091905280548290811061076f57600080fd5b600054610100900460ff161580801561138a5750600054600160ff909116105b806113a45750303b1580156113a4575060005460ff166001145b6114075760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610681565b6000805460ff19166001179055801561142a576000805461ff0019166101001790555b611432612c0b565b8015611478576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50565b6060808361148881612097565b6114a45760405162461bcd60e51b81526004016106819061370d565b336000908152606b602090815260408083206001600160a01b03891684529091529020548411156115175760405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e74204e43542f4243542062616c616e6365000000006044820152606401610681565b604051634c02cad160e01b81526004810185905285906001600160a01b03821690634c02cad190602401600060405180830381600087803b15801561155b57600080fd5b505af115801561156f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261159791908101906132dc565b336000908152606b602090815260408083206001600160a01b038c1684529091528120805493975091955087926115cf908490613825565b9091555050835160005b8181101561169f5784818151811061160157634e487b7160e01b600052603260045260246000fd5b6020026020010151606b6000336001600160a01b03166001600160a01b03168152602001908152602001600020600088848151811061165057634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206000828254611687919061380d565b90915550819050611697816138a3565b9150506115d9565b507f3d29f82a20ec733db9f357c4dc1ae0ee60c572cc4b877384aa4639e4d877b188338887876040516116d594939291906135a1565b60405180910390a15050509250929050565b826116f18161224f565b61170d5760405162461bcd60e51b8152600401610681906136d6565b8261171781612097565b6117335760405162461bcd60e51b81526004016106819061370d565b60008061174187878761210f565b9150915060008160008151811061176857634e487b7160e01b600052603260045260246000fd5b6020908102919091010151905061178a6001600160a01b03891633308461289a565b60675460405163095ea7b360e01b81526001600160a01b039182166004820152602481018390529089169063095ea7b390604401602060405180830381600087803b1580156117d857600080fd5b505af11580156117ec573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061181091906133d5565b5060006118256067546001600160a01b031690565b6001600160a01b0316638803dbee88848730426040518663ffffffff1660e01b815260040161185895949392919061377c565b600060405180830381600087803b15801561187257600080fd5b505af1158015611886573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526118ae91908101906133a2565b905081816000815181106118d257634e487b7160e01b600052603260045260246000fd5b602002602001015110156119685760675460405163095ea7b360e01b81526001600160a01b03918216600482015260006024820152908a169063095ea7b390604401602060405180830381600087803b15801561192e57600080fd5b505af1158015611942573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061196691906133d5565b505b336000908152606b602090815260408083206001600160a01b038c1684529091528120805489929061199b90849061380d565b9091555050505050505050505050565b6119b3612b5f565b606560006066836040516119c79190613585565b90815260200160405180910390206000815481106119f557634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528201929092526040018120611a2291612f0e565b606681604051611a329190613585565b908152602001604051809103902060006114789190612f0e565b6060806000611a5c868686610b5f565b9050611a68858261147b565b9093509150611a77838361078b565b50935093915050565b606080611a8e8585856116e7565b611a98848461147b565b9092509050611aa7828261078b565b935093915050565b6000611aba82612097565b92915050565b600061a4ec461415611ae45760405162461bcd60e51b815260040161068190613688565b82611aee81612097565b611b0a5760405162461bcd60e51b81526004016106819061370d565b60006066604051611b279065574d4154494360d01b815260060190565b9081526020016040518091039020600081548110611b5557634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b03169150611b76828787612a29565b9150508060018251611b889190613825565b8151811061074057634e487b7160e01b600052603260045260246000fd5b611bae612b5f565b806065600083600081518110611bd457634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000209080519060200190611c0f929190612f2c565b5080606683604051611c219190613585565b90815260200160405180910390209080519060200190611c42929190612f2c565b50606980546001810182556000919091528251611c86917f7fb4302e8e91f9110a6554c2c0a24601252c2a42c2220ca988efcfe39991430801906020850190612f91565b505050565b611c93612b5f565b606880546001810182556000919091527fa2153420d844928b4421650203c77babc8b33d7f2e7b450e2966db0c220977530180546001600160a01b0319166001600160a01b0392909216919091179055565b606a8281548110611cf557600080fd5b90600052602060002001818154811061076f57600080fd5b606080610b3f8484610d0a565b600061a4ec461415611d3e5760405162461bcd60e51b815260040161068190613688565b81611d4881612097565b611d645760405162461bcd60e51b81526004016106819061370d565b60405165574d4154494360d01b815234906000906066906006019081526020016040518091039020600081548110611dac57634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b03169150611dcc82876122e8565b80519091506000611de56067546001600160a01b031690565b6001600160a01b0316637ff36ab58660008630426040518663ffffffff1660e01b8152600401611e189493929190613620565b6000604051808303818588803b158015611e3157600080fd5b505af1158015611e45573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052611e6e91908101906133a2565b905080611e7c600184613825565b81518110611e9a57634e487b7160e01b600052603260045260246000fd5b602090810291909101810151336000908152606b835260408082206001600160a01b038d168352909352918220805491995089929091611edb90849061380d565b909155509698975050505050505050565b60608061a4ec461415611f115760405162461bcd60e51b815260040161068190613688565b6000611f1c84611d1a565b9050611f28848261147b565b9093509150611f37838361078b565b50915091565b611f45612b5f565b6001600160a01b038116611faa5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610681565b61147881612bb9565b336000908152606b602090815260408083206001600160a01b038616845290915290205481111561201d5760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b6044820152606401610681565b6120316001600160a01b0383163383612c7f565b336000908152606b602090815260408083206001600160a01b038616845290915281208054839290612064908490613825565b90915550505050565b6068818154811061207d57600080fd5b6000918252602090912001546001600160a01b0316905081565b6000805b60685481101561210657826001600160a01b0316606882815481106120d057634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156120f45750600192915050565b806120fe816138a3565b91505061209b565b50600092915050565b60608061211c85856122e8565b80519092506121336067546001600160a01b031690565b6001600160a01b0316631f00ca7485856040518363ffffffff1660e01b8152600401612160929190613763565b60006040518083038186803b15801561217857600080fd5b505afa15801561218c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526121b491908101906133a2565b9150815181146121d65760405162461bcd60e51b81526004016106819061373b565b816121e2600183613825565b8151811061220057634e487b7160e01b600052603260045260246000fd5b60200260200101518414611a775760405162461bcd60e51b815260206004820152601660248201527509eeae8e0eae840c2dadeeadce840dad2e6dac2e8c6d60531b6044820152606401610681565b6000805b606a5481101561210657826001600160a01b0316606a828154811061228857634e487b7160e01b600052603260045260246000fd5b906000526020600020016000815481106122b257634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156122d65750600192915050565b806122e0816138a3565b915050612253565b6001600160a01b03821660009081526065602052604090205460609060018114156123b7576040805160028082526060820183529091602083019080368337019050509150838260008151811061234f57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050828260018151811061239157634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505050611aba565b80600214156124d057604080516003808252608082019092529060208201606080368337019050509150838260008151811061240357634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600190811061244f57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260018151811061248e57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050828260028151811061239157634e487b7160e01b600052603260045260246000fd5b806003141561267457604080516003808252608082019092529060208201606080368337019050509150838260008151811061251c57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600190811061256857634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826001815181106125a757634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092018101919091529085166000908152606590915260409020805460029081106125f357634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260028151811061263257634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050828260038151811061239157634e487b7160e01b600052603260045260246000fd5b60408051600480825260a08201909252906020820160808036833701905050915083826000815181106126b757634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600190811061270357634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260018151811061274257634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600290811061278e57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826002815181106127cd57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600390811061281957634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260038151811061285857634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050828260048151811061239157634e487b7160e01b600052603260045260246000fd5b6040516001600160a01b0380851660248301528316604482015260648101829052610a779085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612caf565b80158061298e5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561295457600080fd5b505afa158015612968573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061298c91906134da565b155b6129f95760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610681565b6040516001600160a01b038316602482015260448101829052611c8690849063095ea7b360e01b906064016128ce565b606080612a3685856122e8565b8051909250612a4d6067546001600160a01b031690565b6001600160a01b031663d06ca61f85856040518363ffffffff1660e01b8152600401612a7a929190613763565b60006040518083038186803b158015612a9257600080fd5b505afa158015612aa6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612ace91908101906133a2565b915081518114612af05760405162461bcd60e51b81526004016106819061373b565b81600081518110612b1157634e487b7160e01b600052603260045260246000fd5b60200260200101518414611a775760405162461bcd60e51b8152602060048201526015602482015274092dce0eae840c2dadeeadce840dad2e6dac2e8c6d605b1b6044820152606401610681565b6033546001600160a01b0316331461133d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610681565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16612c765760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610681565b61133d33612bb9565b6040516001600160a01b038316602482015260448101829052611c8690849063a9059cbb60e01b906064016128ce565b6000612d04826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612d819092919063ffffffff16565b805190915015611c865780806020019051810190612d2291906133d5565b611c865760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610681565b6060612d908484600085612d98565b949350505050565b606082471015612df95760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610681565b600080866001600160a01b03168587604051612e159190613585565b60006040518083038185875af1925050503d8060008114612e52576040519150601f19603f3d011682016040523d82523d6000602084013e612e57565b606091505b5091509150612e6887838387612e73565b979650505050505050565b60608315612edf578251612ed8576001600160a01b0385163b612ed85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610681565b5081612d90565b612d908383815115612ef45781518083602001fd5b8060405162461bcd60e51b81526004016106819190613655565b50805460008255906000526020600020908101906114789190613005565b828054828255906000526020600020908101928215612f81579160200282015b82811115612f8157825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190612f4c565b50612f8d929150613005565b5090565b828054612f9d90613868565b90600052602060002090601f016020900481019282612fbf5760008555612f81565b82601f10612fd857805160ff1916838001178555612f81565b82800160010185558215612f81579182015b82811115612f81578251825591602001919060010190612fea565b5b80821115612f8d5760008155600101613006565b600082601f83011261302a578081fd5b8135602061303f61303a836137e9565b6137b8565b80838252828201915082860187848660051b890101111561305e578586fd5b855b85811015613085578135613073816138ea565b84529284019290840190600101613060565b5090979650505050505050565b600082601f8301126130a2578081fd5b815160206130b261303a836137e9565b80838252828201915082860187848660051b89010111156130d1578586fd5b855b85811015613085578151845292840192908401906001016130d3565b600082601f8301126130ff578081fd5b813567ffffffffffffffff811115613119576131196138d4565b61312c601f8201601f19166020016137b8565b818152846020838601011115613140578283fd5b816020850160208301379081016020019190915292915050565b60006020828403121561316b578081fd5b8135613176816138ea565b9392505050565b6000806040838503121561318f578081fd5b823561319a816138ea565b915060208301356131aa816138ea565b809150509250929050565b6000806000606084860312156131c9578081fd5b83356131d4816138ea565b925060208401356131e4816138ea565b929592945050506040919091013590565b60008060408385031215613207578182fd5b8235613212816138ea565b946020939093013593505050565b60008060408385031215613232578182fd5b823567ffffffffffffffff80821115613249578384fd5b6132558683870161301a565b935060209150818501358181111561326b578384fd5b85019050601f8101861361327d578283fd5b803561328b61303a826137e9565b80828252848201915084840189868560051b87010111156132aa578687fd5b8694505b838510156132cc5780358352600194909401939185019185016132ae565b5080955050505050509250929050565b600080604083850312156132ee578182fd5b825167ffffffffffffffff80821115613305578384fd5b818501915085601f830112613318578384fd5b8151602061332861303a836137e9565b8083825282820191508286018a848660051b8901011115613347578889fd5b8896505b8487101561337257805161335e816138ea565b83526001969096019591830191830161334b565b509188015191965090935050508082111561338b578283fd5b5061339885828601613092565b9150509250929050565b6000602082840312156133b3578081fd5b815167ffffffffffffffff8111156133c9578182fd5b612d9084828501613092565b6000602082840312156133e6578081fd5b81518015158114613176578182fd5b600060208284031215613406578081fd5b813567ffffffffffffffff81111561341c578182fd5b612d90848285016130ef565b6000806040838503121561343a578182fd5b823567ffffffffffffffff80821115613451578384fd5b61345d868387016130ef565b93506020850135915080821115613472578283fd5b506133988582860161301a565b60008060408385031215613491578182fd5b823567ffffffffffffffff8111156134a7578283fd5b6134b3858286016130ef565b95602094909401359450505050565b6000602082840312156134d3578081fd5b5035919050565b6000602082840312156134eb578081fd5b5051919050565b60008060408385031215613504578182fd5b50508035926020909101359150565b6000815180845260208085019450808401835b8381101561354b5781516001600160a01b031687529582019590820190600101613526565b509495945050505050565b6000815180845260208085019450808401835b8381101561354b57815187529582019590820190600101613569565b6000825161359781846020870161383c565b9190910192915050565b6001600160a01b038581168252841660208201526080604082018190526000906135cd90830185613513565b8281036060840152612e688185613556565b6020815260006131766020830184613513565b6040815260006136056040830185613513565b82810360208401526136178185613556565b95945050505050565b8481526080602082015260006136396080830186613513565b6001600160a01b03949094166040830152506060015292915050565b602081526000825180602084015261367481604085016020870161383c565b601f01601f19169190910160400192915050565b6020808252602e908201527f5468652066756e6374696f6e206973206e6f7420617661696c61626c65206f6e60408201526d103a3434b9903732ba3bb7b9359760911b606082015260800190565b60208082526018908201527f5061746820646f65736e277420796574206578697374732e0000000000000000604082015260600190565b602080825260149082015273546f6b656e206e6f742072656465656d61626c6560601b604082015260600190565b6020808252600e908201526d105c9c985e5cc81d5b995c5d585b60921b604082015260600190565b828152604060208201526000612d906040830184613513565b85815284602082015260a06040820152600061379b60a0830186613513565b6001600160a01b0394909416606083015250608001529392505050565b604051601f8201601f1916810167ffffffffffffffff811182821017156137e1576137e16138d4565b604052919050565b600067ffffffffffffffff821115613803576138036138d4565b5060051b60200190565b60008219821115613820576138206138be565b500190565b600082821015613837576138376138be565b500390565b60005b8381101561385757818101518382015260200161383f565b83811115610a775750506000910152565b600181811c9082168061387c57607f821691505b6020821081141561389d57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156138b7576138b76138be565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461147857600080fdfea26469706673582212200f2bb74b64168c68a4845864d66a79cf1c4ab79c19c33d5a3cd70163e4a3de7564736f6c63430008040033", - "deployedBytecode": "0x6080604052600436106101e55760003560e01c80638da5cb5b11610101578063c23f001f1161009a578063e7f67fb11161006c578063e7f67fb1146105ca578063f04ad9d7146105ea578063f2fde38b146105fd578063f3fef3a31461061d578063feb21b9c1461063d57005b8063c23f001f1461053f578063c6c53efb14610577578063d08ec47514610597578063d8a90c40146105b757005b8063a2844a86116100d3578063a2844a86146104af578063b4e76a86146104df578063b8baf9db146104ff578063c0681c3d1461051f57005b80638da5cb5b146104315780639753209d1461044f578063a09457221461046f578063a0cd60491461048f57005b80635367cd9c1161017e578063715018a611610150578063715018a6146103a757806373200b11146103bc5780638129fc1c146103dc57806382155e7e146103f15780638474c2881461041157005b80635367cd9c1461031a57806356a7de0d1461032d57806368d306d91461034d5780636d4565041461037a57005b80632e98c814116101b75780632e98c8141461029957806335bab7e5146102ba57806347e7ef24146102da5780634865b2b4146102fa57005b80631109ec99146101ee5780631357b113146102215780631661f818146102595780631a0fdecc1461027957005b366101ec57005b005b3480156101fa57600080fd5b5061020e6102093660046131f5565b61065d565b6040519081526020015b60405180910390f35b34801561022d57600080fd5b5061024161023c3660046131f5565b610753565b6040516001600160a01b039091168152602001610218565b34801561026557600080fd5b506101ec610274366004613220565b61078b565b34801561028557600080fd5b5061020e6102943660046131b5565b610a7d565b6102ac6102a73660046131f5565b610b10565b6040516102189291906135f2565b3480156102c657600080fd5b5061020e6102d53660046131b5565b610b5f565b3480156102e657600080fd5b506101ec6102f53660046131f5565b610d0a565b34801561030657600080fd5b5061020e6103153660046131b5565b610d82565b6101ec6103283660046131f5565b610e0d565b34801561033957600080fd5b506101ec61034836600461315a565b6110bd565b34801561035957600080fd5b5061036d61036836600461315a565b611209565b60405161021891906135df565b34801561038657600080fd5b5061039a6103953660046134c2565b61127f565b6040516102189190613655565b3480156103b357600080fd5b506101ec61132b565b3480156103c857600080fd5b506102416103d736600461347f565b61133f565b3480156103e857600080fd5b506101ec61136a565b3480156103fd57600080fd5b506102ac61040c3660046131f5565b61147b565b34801561041d57600080fd5b506101ec61042c3660046131b5565b6116e7565b34801561043d57600080fd5b506033546001600160a01b0316610241565b34801561045b57600080fd5b506101ec61046a3660046133f5565b6119ab565b34801561047b57600080fd5b506102ac61048a3660046131b5565b611a4c565b34801561049b57600080fd5b506102ac6104aa3660046131b5565b611a80565b3480156104bb57600080fd5b506104cf6104ca36600461315a565b611aaf565b6040519015158152602001610218565b3480156104eb57600080fd5b5061020e6104fa3660046131f5565b611ac0565b34801561050b57600080fd5b506101ec61051a366004613428565b611ba6565b34801561052b57600080fd5b506101ec61053a36600461315a565b611c8b565b34801561054b57600080fd5b5061020e61055a36600461317d565b606b60209081526000928352604080842090915290825290205481565b34801561058357600080fd5b506102416105923660046134f2565b611ce5565b3480156105a357600080fd5b506102ac6105b23660046131f5565b611d0d565b61020e6105c536600461315a565b611d1a565b3480156105d657600080fd5b50606754610241906001600160a01b031681565b6102ac6105f836600461315a565b611eec565b34801561060957600080fd5b506101ec61061836600461315a565b611f3d565b34801561062957600080fd5b506101ec6106383660046131f5565b611fb3565b34801561064957600080fd5b506102416106583660046134c2565b61206d565b600061a4ec46141561068a5760405162461bcd60e51b815260040161068190613688565b60405180910390fd5b8261069481612097565b6106b05760405162461bcd60e51b81526004016106819061370d565b600060666040516106cd9065574d4154494360d01b815260060190565b90815260200160405180910390206000815481106106fb57634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b0316915061071c82878761210f565b9150508060008151811061074057634e487b7160e01b600052603260045260246000fd5b6020026020010151935050505092915050565b6065602052816000526040600020818154811061076f57600080fd5b6000918252602090912001546001600160a01b03169150829050565b8151806107c85760405162461bcd60e51b815260206004820152600b60248201526a417272617920656d70747960a81b6044820152606401610681565b815181146107e85760405162461bcd60e51b81526004016106819061373b565b60005b81811015610a775782818151811061081357634e487b7160e01b600052603260045260246000fd5b60200260200101516000141561082b576001016107eb565b82818151811061084b57634e487b7160e01b600052603260045260246000fd5b6020026020010151606b6000336001600160a01b03166001600160a01b03168152602001908152602001600020600086848151811061089a57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000205410156109115760405162461bcd60e51b815260206004820152601960248201527f496e73756666696369656e742054434f322062616c616e6365000000000000006044820152606401610681565b82818151811061093157634e487b7160e01b600052603260045260246000fd5b6020026020010151606b6000336001600160a01b03166001600160a01b03168152602001908152602001600020600086848151811061098057634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060008282546109b79190613825565b925050819055508381815181106109de57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316633790cf57848381518110610a1457634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b8152600401610a3a91815260200190565b600060405180830381600087803b158015610a5457600080fd5b505af1158015610a68573d6000803e3d6000fd5b505050508060010190506107eb565b50505050565b600083610a898161224f565b610aa55760405162461bcd60e51b8152600401610681906136d6565b83610aaf81612097565b610acb5760405162461bcd60e51b81526004016106819061370d565b6000610ad887878761210f565b91505080600081518110610afc57634e487b7160e01b600052603260045260246000fd5b602002602001015193505050509392505050565b60608061a4ec461415610b355760405162461bcd60e51b815260040161068190613688565b610b3f8484610e0d565b610b49848461147b565b9092509050610b58828261078b565b9250929050565b600083610b6b8161224f565b610b875760405162461bcd60e51b8152600401610681906136d6565b83610b9181612097565b610bad5760405162461bcd60e51b81526004016106819061370d565b6000610bb987876122e8565b8051909150610bd36001600160a01b03891633308961289a565b606754610bed906001600160a01b038a8116911688612905565b6000610c016067546001600160a01b031690565b6001600160a01b03166338ed17398860008630426040518663ffffffff1660e01b8152600401610c3595949392919061377c565b600060405180830381600087803b158015610c4f57600080fd5b505af1158015610c63573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c8b91908101906133a2565b905080610c99600184613825565b81518110610cb757634e487b7160e01b600052603260045260246000fd5b602090810291909101810151336000908152606b835260408082206001600160a01b038d168352909352918220805491985088929091610cf890849061380d565b90915550959998505050505050505050565b81610d1481612097565b610d305760405162461bcd60e51b81526004016106819061370d565b610d456001600160a01b03841633308561289a565b336000908152606b602090815260408083206001600160a01b038716845290915281208054849290610d7890849061380d565b9091555050505050565b600083610d8e8161224f565b610daa5760405162461bcd60e51b8152600401610681906136d6565b83610db481612097565b610dd05760405162461bcd60e51b81526004016106819061370d565b6000610ddd878787612a29565b9150508060018251610def9190613825565b81518110610afc57634e487b7160e01b600052603260045260246000fd5b61a4ec461415610e2f5760405162461bcd60e51b815260040161068190613688565b81610e3981612097565b610e555760405162461bcd60e51b81526004016106819061370d565b60006066604051610e729065574d4154494360d01b815260060190565b9081526020016040518091039020600081548110610ea057634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b03169150610ec082866122e8565b90506000610ed66067546001600160a01b031690565b6001600160a01b031663fb3bdb4134878530426040518663ffffffff1660e01b8152600401610f089493929190613620565b6000604051808303818588803b158015610f2157600080fd5b505af1158015610f35573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052610f5e91908101906133a2565b905080600081518110610f8157634e487b7160e01b600052603260045260246000fd5b602002602001015134111561107d57600081600081518110610fb357634e487b7160e01b600052603260045260246000fd5b602002602001015134610fc69190613825565b604080516000808252602082019283905292935033918491610fe791613585565b60006040518083038185875af1925050503d8060008114611024576040519150601f19603f3d011682016040523d82523d6000602084013e611029565b606091505b505090508061107a5760405162461bcd60e51b815260206004820152601b60248201527f4661696c656420746f2073656e6420737572706c7573206261636b00000000006044820152606401610681565b50505b336000908152606b602090815260408083206001600160a01b038a168452909152812080548792906110b090849061380d565b9091555050505050505050565b6110c5612b5f565b60005b60685481101561120557816001600160a01b0316606882815481106110fd57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156111f3576068805461112890600190613825565b8154811061114657634e487b7160e01b600052603260045260246000fd5b600091825260209091200154606880546001600160a01b03909216918390811061118057634e487b7160e01b600052603260045260246000fd5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060688054806111cd57634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b03191690550190555050565b806111fd816138a3565b9150506110c8565b5050565b6001600160a01b03811660009081526065602090815260409182902080548351818402810184019094528084526060939283018282801561127357602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611255575b50505050509050919050565b6069818154811061128f57600080fd5b9060005260206000200160009150905080546112aa90613868565b80601f01602080910402602001604051908101604052809291908181526020018280546112d690613868565b80156113235780601f106112f857610100808354040283529160200191611323565b820191906000526020600020905b81548152906001019060200180831161130657829003601f168201915b505050505081565b611333612b5f565b61133d6000612bb9565b565b8151602081840181018051606682529282019185019190912091905280548290811061076f57600080fd5b600054610100900460ff161580801561138a5750600054600160ff909116105b806113a45750303b1580156113a4575060005460ff166001145b6114075760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610681565b6000805460ff19166001179055801561142a576000805461ff0019166101001790555b611432612c0b565b8015611478576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50565b6060808361148881612097565b6114a45760405162461bcd60e51b81526004016106819061370d565b336000908152606b602090815260408083206001600160a01b03891684529091529020548411156115175760405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e74204e43542f4243542062616c616e6365000000006044820152606401610681565b604051634c02cad160e01b81526004810185905285906001600160a01b03821690634c02cad190602401600060405180830381600087803b15801561155b57600080fd5b505af115801561156f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261159791908101906132dc565b336000908152606b602090815260408083206001600160a01b038c1684529091528120805493975091955087926115cf908490613825565b9091555050835160005b8181101561169f5784818151811061160157634e487b7160e01b600052603260045260246000fd5b6020026020010151606b6000336001600160a01b03166001600160a01b03168152602001908152602001600020600088848151811061165057634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206000828254611687919061380d565b90915550819050611697816138a3565b9150506115d9565b507f3d29f82a20ec733db9f357c4dc1ae0ee60c572cc4b877384aa4639e4d877b188338887876040516116d594939291906135a1565b60405180910390a15050509250929050565b826116f18161224f565b61170d5760405162461bcd60e51b8152600401610681906136d6565b8261171781612097565b6117335760405162461bcd60e51b81526004016106819061370d565b60008061174187878761210f565b9150915060008160008151811061176857634e487b7160e01b600052603260045260246000fd5b6020908102919091010151905061178a6001600160a01b03891633308461289a565b60675460405163095ea7b360e01b81526001600160a01b039182166004820152602481018390529089169063095ea7b390604401602060405180830381600087803b1580156117d857600080fd5b505af11580156117ec573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061181091906133d5565b5060006118256067546001600160a01b031690565b6001600160a01b0316638803dbee88848730426040518663ffffffff1660e01b815260040161185895949392919061377c565b600060405180830381600087803b15801561187257600080fd5b505af1158015611886573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526118ae91908101906133a2565b905081816000815181106118d257634e487b7160e01b600052603260045260246000fd5b602002602001015110156119685760675460405163095ea7b360e01b81526001600160a01b03918216600482015260006024820152908a169063095ea7b390604401602060405180830381600087803b15801561192e57600080fd5b505af1158015611942573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061196691906133d5565b505b336000908152606b602090815260408083206001600160a01b038c1684529091528120805489929061199b90849061380d565b9091555050505050505050505050565b6119b3612b5f565b606560006066836040516119c79190613585565b90815260200160405180910390206000815481106119f557634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528201929092526040018120611a2291612f0e565b606681604051611a329190613585565b908152602001604051809103902060006114789190612f0e565b6060806000611a5c868686610b5f565b9050611a68858261147b565b9093509150611a77838361078b565b50935093915050565b606080611a8e8585856116e7565b611a98848461147b565b9092509050611aa7828261078b565b935093915050565b6000611aba82612097565b92915050565b600061a4ec461415611ae45760405162461bcd60e51b815260040161068190613688565b82611aee81612097565b611b0a5760405162461bcd60e51b81526004016106819061370d565b60006066604051611b279065574d4154494360d01b815260060190565b9081526020016040518091039020600081548110611b5557634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b03169150611b76828787612a29565b9150508060018251611b889190613825565b8151811061074057634e487b7160e01b600052603260045260246000fd5b611bae612b5f565b806065600083600081518110611bd457634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000209080519060200190611c0f929190612f2c565b5080606683604051611c219190613585565b90815260200160405180910390209080519060200190611c42929190612f2c565b50606980546001810182556000919091528251611c86917f7fb4302e8e91f9110a6554c2c0a24601252c2a42c2220ca988efcfe39991430801906020850190612f91565b505050565b611c93612b5f565b606880546001810182556000919091527fa2153420d844928b4421650203c77babc8b33d7f2e7b450e2966db0c220977530180546001600160a01b0319166001600160a01b0392909216919091179055565b606a8281548110611cf557600080fd5b90600052602060002001818154811061076f57600080fd5b606080610b3f8484610d0a565b600061a4ec461415611d3e5760405162461bcd60e51b815260040161068190613688565b81611d4881612097565b611d645760405162461bcd60e51b81526004016106819061370d565b60405165574d4154494360d01b815234906000906066906006019081526020016040518091039020600081548110611dac57634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b03169150611dcc82876122e8565b80519091506000611de56067546001600160a01b031690565b6001600160a01b0316637ff36ab58660008630426040518663ffffffff1660e01b8152600401611e189493929190613620565b6000604051808303818588803b158015611e3157600080fd5b505af1158015611e45573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052611e6e91908101906133a2565b905080611e7c600184613825565b81518110611e9a57634e487b7160e01b600052603260045260246000fd5b602090810291909101810151336000908152606b835260408082206001600160a01b038d168352909352918220805491995089929091611edb90849061380d565b909155509698975050505050505050565b60608061a4ec461415611f115760405162461bcd60e51b815260040161068190613688565b6000611f1c84611d1a565b9050611f28848261147b565b9093509150611f37838361078b565b50915091565b611f45612b5f565b6001600160a01b038116611faa5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610681565b61147881612bb9565b336000908152606b602090815260408083206001600160a01b038616845290915290205481111561201d5760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b6044820152606401610681565b6120316001600160a01b0383163383612c7f565b336000908152606b602090815260408083206001600160a01b038616845290915281208054839290612064908490613825565b90915550505050565b6068818154811061207d57600080fd5b6000918252602090912001546001600160a01b0316905081565b6000805b60685481101561210657826001600160a01b0316606882815481106120d057634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156120f45750600192915050565b806120fe816138a3565b91505061209b565b50600092915050565b60608061211c85856122e8565b80519092506121336067546001600160a01b031690565b6001600160a01b0316631f00ca7485856040518363ffffffff1660e01b8152600401612160929190613763565b60006040518083038186803b15801561217857600080fd5b505afa15801561218c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526121b491908101906133a2565b9150815181146121d65760405162461bcd60e51b81526004016106819061373b565b816121e2600183613825565b8151811061220057634e487b7160e01b600052603260045260246000fd5b60200260200101518414611a775760405162461bcd60e51b815260206004820152601660248201527509eeae8e0eae840c2dadeeadce840dad2e6dac2e8c6d60531b6044820152606401610681565b6000805b606a5481101561210657826001600160a01b0316606a828154811061228857634e487b7160e01b600052603260045260246000fd5b906000526020600020016000815481106122b257634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156122d65750600192915050565b806122e0816138a3565b915050612253565b6001600160a01b03821660009081526065602052604090205460609060018114156123b7576040805160028082526060820183529091602083019080368337019050509150838260008151811061234f57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050828260018151811061239157634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505050611aba565b80600214156124d057604080516003808252608082019092529060208201606080368337019050509150838260008151811061240357634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600190811061244f57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260018151811061248e57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050828260028151811061239157634e487b7160e01b600052603260045260246000fd5b806003141561267457604080516003808252608082019092529060208201606080368337019050509150838260008151811061251c57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600190811061256857634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826001815181106125a757634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092018101919091529085166000908152606590915260409020805460029081106125f357634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260028151811061263257634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050828260038151811061239157634e487b7160e01b600052603260045260246000fd5b60408051600480825260a08201909252906020820160808036833701905050915083826000815181106126b757634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600190811061270357634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260018151811061274257634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600290811061278e57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826002815181106127cd57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600390811061281957634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260038151811061285857634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050828260048151811061239157634e487b7160e01b600052603260045260246000fd5b6040516001600160a01b0380851660248301528316604482015260648101829052610a779085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612caf565b80158061298e5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561295457600080fd5b505afa158015612968573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061298c91906134da565b155b6129f95760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610681565b6040516001600160a01b038316602482015260448101829052611c8690849063095ea7b360e01b906064016128ce565b606080612a3685856122e8565b8051909250612a4d6067546001600160a01b031690565b6001600160a01b031663d06ca61f85856040518363ffffffff1660e01b8152600401612a7a929190613763565b60006040518083038186803b158015612a9257600080fd5b505afa158015612aa6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612ace91908101906133a2565b915081518114612af05760405162461bcd60e51b81526004016106819061373b565b81600081518110612b1157634e487b7160e01b600052603260045260246000fd5b60200260200101518414611a775760405162461bcd60e51b8152602060048201526015602482015274092dce0eae840c2dadeeadce840dad2e6dac2e8c6d605b1b6044820152606401610681565b6033546001600160a01b0316331461133d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610681565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16612c765760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610681565b61133d33612bb9565b6040516001600160a01b038316602482015260448101829052611c8690849063a9059cbb60e01b906064016128ce565b6000612d04826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612d819092919063ffffffff16565b805190915015611c865780806020019051810190612d2291906133d5565b611c865760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610681565b6060612d908484600085612d98565b949350505050565b606082471015612df95760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610681565b600080866001600160a01b03168587604051612e159190613585565b60006040518083038185875af1925050503d8060008114612e52576040519150601f19603f3d011682016040523d82523d6000602084013e612e57565b606091505b5091509150612e6887838387612e73565b979650505050505050565b60608315612edf578251612ed8576001600160a01b0385163b612ed85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610681565b5081612d90565b612d908383815115612ef45781518083602001fd5b8060405162461bcd60e51b81526004016106819190613655565b50805460008255906000526020600020908101906114789190613005565b828054828255906000526020600020908101928215612f81579160200282015b82811115612f8157825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190612f4c565b50612f8d929150613005565b5090565b828054612f9d90613868565b90600052602060002090601f016020900481019282612fbf5760008555612f81565b82601f10612fd857805160ff1916838001178555612f81565b82800160010185558215612f81579182015b82811115612f81578251825591602001919060010190612fea565b5b80821115612f8d5760008155600101613006565b600082601f83011261302a578081fd5b8135602061303f61303a836137e9565b6137b8565b80838252828201915082860187848660051b890101111561305e578586fd5b855b85811015613085578135613073816138ea565b84529284019290840190600101613060565b5090979650505050505050565b600082601f8301126130a2578081fd5b815160206130b261303a836137e9565b80838252828201915082860187848660051b89010111156130d1578586fd5b855b85811015613085578151845292840192908401906001016130d3565b600082601f8301126130ff578081fd5b813567ffffffffffffffff811115613119576131196138d4565b61312c601f8201601f19166020016137b8565b818152846020838601011115613140578283fd5b816020850160208301379081016020019190915292915050565b60006020828403121561316b578081fd5b8135613176816138ea565b9392505050565b6000806040838503121561318f578081fd5b823561319a816138ea565b915060208301356131aa816138ea565b809150509250929050565b6000806000606084860312156131c9578081fd5b83356131d4816138ea565b925060208401356131e4816138ea565b929592945050506040919091013590565b60008060408385031215613207578182fd5b8235613212816138ea565b946020939093013593505050565b60008060408385031215613232578182fd5b823567ffffffffffffffff80821115613249578384fd5b6132558683870161301a565b935060209150818501358181111561326b578384fd5b85019050601f8101861361327d578283fd5b803561328b61303a826137e9565b80828252848201915084840189868560051b87010111156132aa578687fd5b8694505b838510156132cc5780358352600194909401939185019185016132ae565b5080955050505050509250929050565b600080604083850312156132ee578182fd5b825167ffffffffffffffff80821115613305578384fd5b818501915085601f830112613318578384fd5b8151602061332861303a836137e9565b8083825282820191508286018a848660051b8901011115613347578889fd5b8896505b8487101561337257805161335e816138ea565b83526001969096019591830191830161334b565b509188015191965090935050508082111561338b578283fd5b5061339885828601613092565b9150509250929050565b6000602082840312156133b3578081fd5b815167ffffffffffffffff8111156133c9578182fd5b612d9084828501613092565b6000602082840312156133e6578081fd5b81518015158114613176578182fd5b600060208284031215613406578081fd5b813567ffffffffffffffff81111561341c578182fd5b612d90848285016130ef565b6000806040838503121561343a578182fd5b823567ffffffffffffffff80821115613451578384fd5b61345d868387016130ef565b93506020850135915080821115613472578283fd5b506133988582860161301a565b60008060408385031215613491578182fd5b823567ffffffffffffffff8111156134a7578283fd5b6134b3858286016130ef565b95602094909401359450505050565b6000602082840312156134d3578081fd5b5035919050565b6000602082840312156134eb578081fd5b5051919050565b60008060408385031215613504578182fd5b50508035926020909101359150565b6000815180845260208085019450808401835b8381101561354b5781516001600160a01b031687529582019590820190600101613526565b509495945050505050565b6000815180845260208085019450808401835b8381101561354b57815187529582019590820190600101613569565b6000825161359781846020870161383c565b9190910192915050565b6001600160a01b038581168252841660208201526080604082018190526000906135cd90830185613513565b8281036060840152612e688185613556565b6020815260006131766020830184613513565b6040815260006136056040830185613513565b82810360208401526136178185613556565b95945050505050565b8481526080602082015260006136396080830186613513565b6001600160a01b03949094166040830152506060015292915050565b602081526000825180602084015261367481604085016020870161383c565b601f01601f19169190910160400192915050565b6020808252602e908201527f5468652066756e6374696f6e206973206e6f7420617661696c61626c65206f6e60408201526d103a3434b9903732ba3bb7b9359760911b606082015260800190565b60208082526018908201527f5061746820646f65736e277420796574206578697374732e0000000000000000604082015260600190565b602080825260149082015273546f6b656e206e6f742072656465656d61626c6560601b604082015260600190565b6020808252600e908201526d105c9c985e5cc81d5b995c5d585b60921b604082015260600190565b828152604060208201526000612d906040830184613513565b85815284602082015260a06040820152600061379b60a0830186613513565b6001600160a01b0394909416606083015250608001529392505050565b604051601f8201601f1916810167ffffffffffffffff811182821017156137e1576137e16138d4565b604052919050565b600067ffffffffffffffff821115613803576138036138d4565b5060051b60200190565b60008219821115613820576138206138be565b500190565b600082821015613837576138376138be565b500390565b60005b8381101561385757818101518382015260200161383f565b83811115610a775750506000910152565b600181811c9082168061387c57607f821691505b6020821081141561389d57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156138b7576138b76138be565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461147857600080fdfea26469706673582212200f2bb74b64168c68a4845864d66a79cf1c4ab79c19c33d5a3cd70163e4a3de7564736f6c63430008040033", + "numDeployments": 7, + "solcInputHash": "75278ec65526f1e0033cc879f57dc68d", + "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_poolAddresses\",\"type\":\"address[]\"},{\"internalType\":\"string[]\",\"name\":\"_tokenSymbolsForPaths\",\"type\":\"string[]\"},{\"internalType\":\"address[][]\",\"name\":\"_paths\",\"type\":\"address[][]\"},{\"internalType\":\"address\",\"name\":\"_dexRouterAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"poolToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"Redeemed\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_tokenSymbol\",\"type\":\"string\"},{\"internalType\":\"address[]\",\"name\":\"_path\",\"type\":\"address[]\"}],\"name\":\"addPath\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"addPoolToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"autoOffsetExactInETH\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountToSwap\",\"type\":\"uint256\"}],\"name\":\"autoOffsetExactInToken\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountToOffset\",\"type\":\"uint256\"}],\"name\":\"autoOffsetExactOutETH\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountToOffset\",\"type\":\"uint256\"}],\"name\":\"autoOffsetExactOutToken\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountToOffset\",\"type\":\"uint256\"}],\"name\":\"autoOffsetPoolToken\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"autoRedeem\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_amounts\",\"type\":\"uint256[]\"}],\"name\":\"autoRetire\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fromTokenAmount\",\"type\":\"uint256\"}],\"name\":\"calculateExpectedPoolTokenForETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fromAmount\",\"type\":\"uint256\"}],\"name\":\"calculateExpectedPoolTokenForToken\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAmount\",\"type\":\"uint256\"}],\"name\":\"calculateNeededETHAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAmount\",\"type\":\"uint256\"}],\"name\":\"calculateNeededTokenAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"dexRouterAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"eligibleSwapPaths\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"eligibleSwapPathsBySymbol\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_erc20Address\",\"type\":\"address\"}],\"name\":\"isERC20AddressEligible\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_path\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"isPoolAddressEligible\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_isEligible\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"paths\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"poolAddresses\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_tokenSymbol\",\"type\":\"string\"}],\"name\":\"removePath\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"removePoolToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"swapExactInETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fromAmount\",\"type\":\"uint256\"}],\"name\":\"swapExactInToken\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAmount\",\"type\":\"uint256\"}],\"name\":\"swapExactOutETH\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAmount\",\"type\":\"uint256\"}],\"name\":\"swapExactOutToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"tokenSymbolsForPaths\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"events\":{\"Redeemed(address,address,address[],uint256[])\":{\"params\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"poolToken\":\"The address of the pool token used in the redemption, e.g., NCT\",\"sender\":\"The sender of the transaction\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}}},\"kind\":\"dev\",\"methods\":{\"addPath(string,address[])\":{\"params\":{\"_path\":\"The path of the path to add\",\"_tokenSymbol\":\"The symbol of the token to add\"}},\"addPoolToken(address)\":{\"params\":{\"_poolToken\":\"The address of the pool token to add\"}},\"autoOffsetExactInETH(address)\":{\"details\":\"This function is only available on Polygon, not on Celo.\",\"params\":{\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoOffsetExactInToken(address,address,uint256)\":{\"details\":\"When automatically redeeming pool tokens for the oldest ones TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool token.\",\"params\":{\"_amountToSwap\":\"The amount of ERC20 token to swap into Toucan pool token. Full amount will be used for offsetting.\",\"_fromToken\":\"The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\",\"_poolToken\":\"The address of the pool token that the user wants to use, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoOffsetExactOutETH(address,uint256)\":{\"details\":\"If the user sends too much native tokens , the leftover amount will be sent back to the user. This function is only available on Polygon, not on Celo.\",\"params\":{\"_amountToOffset\":\"The amount of TCO2 to offset.\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoOffsetExactOutToken(address,address,uint256)\":{\"details\":\"When automatically redeeming pool tokens for the oldest ones TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool token.\",\"params\":{\"_amountToOffset\":\"The amount of TCO2 to offset\",\"_fromToken\":\"The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\",\"_poolToken\":\"The address of the pool token that the user wants to use, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoOffsetPoolToken(address,uint256)\":{\"params\":{\"_amountToOffset\":\"The amount of TCO2 to offset.\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoRedeem(address,uint256)\":{\"details\":\"Needs to be approved on the client side\",\"params\":{\"_amount\":\"Amount to redeem\",\"_fromToken\":\"Could be the address of NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoRetire(address[],uint256[])\":{\"params\":{\"_amounts\":\"The amounts to retire from each of the corresponding TCO2 addresses\",\"_tco2s\":\"The addresses of the TCO2s to retire\"}},\"calculateExpectedPoolTokenForETH(address,uint256)\":{\"params\":{\"_fromTokenAmount\":\"The amount of native tokens to swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amountOut\":\"The expected amount of Pool token that can be acquired\"}},\"calculateExpectedPoolTokenForToken(address,address,uint256)\":{\"params\":{\"_fromAmount\":\"The amount of ERC20 token to swap\",\"_fromToken\":\"The address of the ERC20 token used for the swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amountOut\":\"The expected amount of Pool token that can be acquired\"}},\"calculateNeededETHAmount(address,uint256)\":{\"params\":{\"_poolToken\":\"The address of the pool token to swap for, for example, NCT\",\"_toAmount\":\"The desired amount of pool token to receive\"},\"returns\":{\"amountIn\":\"The amount of native tokens required in order to swap for the specified amount of the pool token\"}},\"calculateNeededTokenAmount(address,address,uint256)\":{\"params\":{\"_fromToken\":\"The address of the ERC20 token used for the swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\",\"_toAmount\":\"The desired amount of pool token to receive\"},\"returns\":{\"amountIn\":\"The amount of the ERC20 token required in order to swap for the specified amount of the pool token\"}},\"constructor\":{\"details\":\"See `isEligible()` for a list of tokens that can be used in the contract. These can be modified after deployment by the contract owner using `setEligibleTokenAddress()` and `deleteEligibleTokenAddress()`.\",\"params\":{\"_paths\":\"An array of arrays of addresses to describe the path needed to swap form the baseToken to the pool Token to the provided token symbols.\",\"_poolAddresses\":\"A list of pool token addresses.\",\"_tokenSymbolsForPaths\":\"An array of symbols of the token the user want to retire carbon credits for\"}},\"isERC20AddressEligible(address)\":{\"params\":{\"_erc20Address\":\"The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\"},\"returns\":{\"_path\":\"Returns the path of the token to be exchanged\"}},\"isPoolAddressEligible(address)\":{\"params\":{\"_poolToken\":\"The addresses of the pool token to redeem\"},\"returns\":{\"_isEligible\":\"Returns if token can be redeemed\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"removePath(string)\":{\"params\":{\"_tokenSymbol\":\"The symbol of the path to remove\"}},\"removePoolToken(address)\":{\"params\":{\"_poolToken\":\"The address of the pool token to remove\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"swapExactInETH(address)\":{\"params\":{\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amountOut\":\"Resulting amount of pool token that got acquired for the swapped native tokens .\"}},\"swapExactInToken(address,address,uint256)\":{\"details\":\"Needs to be approved on the client side.\",\"params\":{\"_fromAmount\":\"The amount of ERC20 token to swap e.g., NCT\",\"_fromToken\":\"The address of the ERC20 token used for the swap\",\"_poolToken\":\"The address of the pool token to swap for,\"},\"returns\":{\"amountOut\":\"Resulting amount of pool token that got acquired for the swapped ERC20 tokens.\"}},\"swapExactOutETH(address,uint256)\":{\"params\":{\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\",\"_toAmount\":\"The required amount of the pool token (NCT/BCT)\"}},\"swapExactOutToken(address,address,uint256)\":{\"details\":\"Needs to be approved on the client side\",\"params\":{\"_fromToken\":\"The address of the ERC20 token used for the swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\",\"_toAmount\":\"The required amount of the pool token (NCT/BCT)\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"title\":\"Toucan Protocol Offset Helpers\",\"version\":1},\"userdoc\":{\"events\":{\"Redeemed(address,address,address[],uint256[])\":{\"notice\":\"Emitted upon successful redemption of TCO2 tokens from a Toucan pool token e.g., NCT.\"}},\"kind\":\"user\",\"methods\":{\"addPath(string,address[])\":{\"notice\":\"Change or add eligible paths and their addresses.\"},\"addPoolToken(address)\":{\"notice\":\"Change or add pool token addresses.\"},\"autoOffsetExactInETH(address)\":{\"notice\":\"Retire carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC. All provided native tokens is consumed for offsetting. Use `calculateExpectedPoolTokenForETH()` to calculate the expected amount of Pool token that can be acquired by swapping the provided amount of native tokens e.g., MATIC. This function: 1. Swaps the Matic sent to the contract for the specified pool token. 2. Redeems the pool token for the oldest TCO2 tokens available. 3. Retires the TCO2 tokens.\"},\"autoOffsetExactInToken(address,address,uint256)\":{\"notice\":\"Retire carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending ERC20 tokens (cUSD, USDC, WETH, WMATIC). All provided token is consumed for offsetting. Use `calculateExpectedPoolTokenForToken()` to calculate the expected amount of Pool token that can be acquired by swapping the provided amount of ERC20 token. This function: 1. Swaps the ERC20 token sent to the contract for the specified pool token. 2. Redeems the pool token for the oldest TCO2 tokens available. 3. Retires the TCO2 tokens. Note: The client must approve the ERC20 token that is sent to the contract.\"},\"autoOffsetExactOutETH(address,uint256)\":{\"notice\":\"Retire carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC. Use `calculateNeededETHAmount()` first in order to find out how much native tokens are required to retire the specified quantity of TCO2. This function: 1. Swaps the Matic sent to the contract for the specified pool token. 2. Redeems the pool token for the oldest TCO2 tokens available. 3. Retires the TCO2 tokens.\"},\"autoOffsetExactOutToken(address,address,uint256)\":{\"notice\":\"Retire carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending ERC20 tokens (cUSD, USDC, WETH, WMATIC). Use `calculateNeededTokenAmount` first in order to find out how much of the ERC20 token is required to retire the specified quantity of TCO2. This function: 1. Swaps the ERC20 token sent to the contract for the specified pool token. 2. Redeems the pool token for the oldest TCO2 tokens available. 3. Retires the TCO2 tokens. Note: The client must approve the ERC20 token that is sent to the contract.\"},\"autoOffsetPoolToken(address,uint256)\":{\"notice\":\"Retire carbon credits using the oldest TCO2 tokens available by sending pool tokens, e.g., NCT. This function: 1. Redeems the pool token for the oldest TCO2 tokens available. 2. Retires the TCO2 tokens. Note: The client must approve the pool token that is sent.\"},\"autoRedeem(address,uint256)\":{\"notice\":\"Redeems the specified amount of NCT / BCT for TCO2.\"},\"autoRetire(address[],uint256[])\":{\"notice\":\"Retire the specified TCO2 tokens.\"},\"calculateExpectedPoolTokenForETH(address,uint256)\":{\"notice\":\"Calculates the expected amount of pool token that can be acquired by swapping the provided amount of native tokens e.g., MATIC.\"},\"calculateExpectedPoolTokenForToken(address,address,uint256)\":{\"notice\":\"Calculates the expected amount of pool token that can be acquired by swapping the provided amount of ERC20 token.\"},\"calculateNeededETHAmount(address,uint256)\":{\"notice\":\"Return how much native tokens e.g, MATIC is required in order to swap for the desired amount of a pool token, e.g., NCT.\"},\"calculateNeededTokenAmount(address,address,uint256)\":{\"notice\":\"Return how much of the specified ERC20 token is required in order to swap for the desired amount of a pool token, for example, e.g., NCT.\"},\"constructor\":{\"notice\":\"Contract constructor. Should specify arrays of ERC20 symbols and addresses that can used by the contract.\"},\"isERC20AddressEligible(address)\":{\"notice\":\"Checks if ERC20 Token is eligible for Offsetting.\"},\"isPoolAddressEligible(address)\":{\"notice\":\"Cheks if Pool Token is eligible for Offsetting.\"},\"removePath(string)\":{\"notice\":\"Delete eligible tokens stored in the contract.\"},\"removePoolToken(address)\":{\"notice\":\"Delete eligible pool token addresses stored in the contract.\"},\"swapExactInETH(address)\":{\"notice\":\"Swap native tokens e.g., MATIC for pool tokens (BCT/NCT) on SushiSwap. All provided native tokens will be swapped.\"},\"swapExactInToken(address,address,uint256)\":{\"notice\":\"Swap eligible ERC20 tokens for pool tokens (BCT/NCT) on SushiSwap. All provided ERC20 tokens will be swapped.\"},\"swapExactOutETH(address,uint256)\":{\"notice\":\"Swap native tokens e.g., MATIC for pool tokens (BCT/NCT) on SushiSwap. Remaining native tokens that was not consumed by the swap is returned.\"},\"swapExactOutToken(address,address,uint256)\":{\"notice\":\"Swap eligible ERC20 tokens for pool tokens (BCT/NCT) on SushiSwap\"}},\"notice\":\"Helper functions that simplify the carbon offsetting (retirement) process. Retiring carbon tokens requires multiple steps and interactions with Toucan Protocol's main contracts: 1. Obtain a pool token e.g., NCT (by performing a token swap on a DEX). 2. Redeem the pool token for a TCO2 token. 3. Retire the TCO2 token. These steps are combined in each of the following \\\"auto offset\\\" methods implemented in `OffsetHelper` to allow a retirement within one transaction: - `autoOffsetPoolToken()` if the user already owns a Toucan pool token e.g., NCT, - `autoOffsetExactOutETH()` if the user would like to perform a retirement using native tokens e.g., MATIC, specifying the exact amount of TCO2s to retire (only on Polygon, not on Celo), - `autoOffsetExactInETH()` if the user would like to perform a retirement using native tokens, swapping all sent native tokens into TCO2s (only on Polygon, not on Celo), - `autoOffsetExactOutToken()` if the user would like to perform a retirement using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount of TCO2s to retire, - `autoOffsetExactInToken()` if the user would like to perform a retirement using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount of token to swap into TCO2s. In these methods, \\\"auto\\\" refers to the fact that these methods use `autoRedeem()` in order to automatically choose a TCO2 token corresponding to the oldest tokenized carbon project in the specfified token pool. There are no fees incurred by the user when using `autoRedeem()`, i.e., the user receives 1 TCO2 token for each pool token (BCT/NCT) redeemed. There are two `view` helper functions `calculateNeededETHAmount()` and `calculateNeededTokenAmount()` that should be called before using `autoOffsetExactOutETH()` and `autoOffsetExactOutToken()`, to determine how much native tokens e.g., MATIC, respectively how much of the ERC20 token must be sent to the `OffsetHelper` contract in order to retire the specified amount of carbon. The two `view` helper functions `calculateExpectedPoolTokenForETH()` and `calculateExpectedPoolTokenForToken()` can be used to calculate the expected amount of TCO2s that will be offset using functions `autoOffsetExactInETH()` and `autoOffsetExactInToken()`.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/OffsetHelper.sol\":\"OffsetHelper\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20Upgradeable {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x4e733d3164f73f461eaf9d8087a7ad1ea180bdc8ba0d3d61b0e1ae16d8e63dff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n function safePermit(\\n IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9b72f93be69ca894d8492c244259615c4a742afc8d63720dbc8bb81087d9b238\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721Receiver {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol\":{\"content\":\"pragma solidity >=0.6.2;\\n\\ninterface IUniswapV2Router01 {\\n function factory() external pure returns (address);\\n function WETH() external pure returns (address);\\n\\n function addLiquidity(\\n address tokenA,\\n address tokenB,\\n uint amountADesired,\\n uint amountBDesired,\\n uint amountAMin,\\n uint amountBMin,\\n address to,\\n uint deadline\\n ) external returns (uint amountA, uint amountB, uint liquidity);\\n function addLiquidityETH(\\n address token,\\n uint amountTokenDesired,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline\\n ) external payable returns (uint amountToken, uint amountETH, uint liquidity);\\n function removeLiquidity(\\n address tokenA,\\n address tokenB,\\n uint liquidity,\\n uint amountAMin,\\n uint amountBMin,\\n address to,\\n uint deadline\\n ) external returns (uint amountA, uint amountB);\\n function removeLiquidityETH(\\n address token,\\n uint liquidity,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline\\n ) external returns (uint amountToken, uint amountETH);\\n function removeLiquidityWithPermit(\\n address tokenA,\\n address tokenB,\\n uint liquidity,\\n uint amountAMin,\\n uint amountBMin,\\n address to,\\n uint deadline,\\n bool approveMax, uint8 v, bytes32 r, bytes32 s\\n ) external returns (uint amountA, uint amountB);\\n function removeLiquidityETHWithPermit(\\n address token,\\n uint liquidity,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline,\\n bool approveMax, uint8 v, bytes32 r, bytes32 s\\n ) external returns (uint amountToken, uint amountETH);\\n function swapExactTokensForTokens(\\n uint amountIn,\\n uint amountOutMin,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external returns (uint[] memory amounts);\\n function swapTokensForExactTokens(\\n uint amountOut,\\n uint amountInMax,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external returns (uint[] memory amounts);\\n function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)\\n external\\n payable\\n returns (uint[] memory amounts);\\n function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)\\n external\\n returns (uint[] memory amounts);\\n function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)\\n external\\n returns (uint[] memory amounts);\\n function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)\\n external\\n payable\\n returns (uint[] memory amounts);\\n\\n function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);\\n function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);\\n function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);\\n function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);\\n function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);\\n}\\n\",\"keccak256\":\"0x8a3c5c449d4b7cd76513ed6995f4b86e4a86f222c770f8442f5fc128ce29b4d2\"},\"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\":{\"content\":\"pragma solidity >=0.6.2;\\n\\nimport './IUniswapV2Router01.sol';\\n\\ninterface IUniswapV2Router02 is IUniswapV2Router01 {\\n function removeLiquidityETHSupportingFeeOnTransferTokens(\\n address token,\\n uint liquidity,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline\\n ) external returns (uint amountETH);\\n function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(\\n address token,\\n uint liquidity,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline,\\n bool approveMax, uint8 v, bytes32 r, bytes32 s\\n ) external returns (uint amountETH);\\n\\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\\n uint amountIn,\\n uint amountOutMin,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external;\\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\\n uint amountOutMin,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external payable;\\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\\n uint amountIn,\\n uint amountOutMin,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external;\\n}\\n\",\"keccak256\":\"0x744e30c133bd0f7ca9e7163433cf6d72f45c6bb1508c2c9c02f1a6db796ae59d\"},\"contracts/OffsetHelper.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2022 Toucan Labs\\n// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\\\";\\nimport \\\"./OffsetHelperStorage.sol\\\";\\nimport \\\"./interfaces/IToucanPoolToken.sol\\\";\\nimport \\\"./interfaces/IToucanCarbonOffsets.sol\\\";\\nimport \\\"./interfaces/IToucanContractRegistry.sol\\\";\\n\\n/**\\n * @title Toucan Protocol Offset Helpers\\n * @notice Helper functions that simplify the carbon offsetting (retirement)\\n * process.\\n *\\n * Retiring carbon tokens requires multiple steps and interactions with\\n * Toucan Protocol's main contracts:\\n * 1. Obtain a pool token e.g., NCT (by performing a token\\n * swap on a DEX).\\n * 2. Redeem the pool token for a TCO2 token.\\n * 3. Retire the TCO2 token.\\n *\\n * These steps are combined in each of the following \\\"auto offset\\\" methods\\n * implemented in `OffsetHelper` to allow a retirement within one transaction:\\n * - `autoOffsetPoolToken()` if the user already owns a Toucan pool\\n * token e.g., NCT,\\n * - `autoOffsetExactOutETH()` if the user would like to perform a retirement\\n * using native tokens e.g., MATIC, specifying the exact amount of TCO2s to retire (only on Polygon, not on Celo),\\n * - `autoOffsetExactInETH()` if the user would like to perform a retirement\\n * using native tokens, swapping all sent native tokens into TCO2s (only on Polygon, not on Celo),\\n * - `autoOffsetExactOutToken()` if the user would like to perform a retirement\\n * using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount\\n * of TCO2s to retire,\\n * - `autoOffsetExactInToken()` if the user would like to perform a retirement\\n * using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount\\n * of token to swap into TCO2s.\\n *\\n * In these methods, \\\"auto\\\" refers to the fact that these methods use\\n * `autoRedeem()` in order to automatically choose a TCO2 token corresponding\\n * to the oldest tokenized carbon project in the specfified token pool.\\n * There are no fees incurred by the user when using `autoRedeem()`, i.e., the\\n * user receives 1 TCO2 token for each pool token (BCT/NCT) redeemed.\\n *\\n * There are two `view` helper functions `calculateNeededETHAmount()` and\\n * `calculateNeededTokenAmount()` that should be called before using\\n * `autoOffsetExactOutETH()` and `autoOffsetExactOutToken()`, to determine how\\n * much native tokens e.g., MATIC, respectively how much of the ERC20 token must be sent to the\\n * `OffsetHelper` contract in order to retire the specified amount of carbon.\\n *\\n * The two `view` helper functions `calculateExpectedPoolTokenForETH()` and\\n * `calculateExpectedPoolTokenForToken()` can be used to calculate the\\n * expected amount of TCO2s that will be offset using functions\\n * `autoOffsetExactInETH()` and `autoOffsetExactInToken()`.\\n */\\ncontract OffsetHelper is OffsetHelperStorage {\\n using SafeERC20 for IERC20;\\n // As Celo allows to pay the gas fees with other tokens than the native token,\\n // it's not possible ot use the swapETH (swap native tokens) functions.\\n uint256 private constant CELO_MAINNET_CHAINID = 42220;\\n uint256 private constant ALFAJORES_MAINNET_CHAINID = 44787;\\n\\n /**\\n * @notice Emitted upon successful redemption of TCO2 tokens from a Toucan\\n * pool token e.g., NCT.\\n *\\n * @param sender The sender of the transaction\\n * @param poolToken The address of the pool token used in the\\n * redemption, e.g., NCT\\n * @param tco2s An array of the TCO2 addresses that were redeemed\\n * @param amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n event Redeemed(\\n address sender,\\n address poolToken,\\n address[] tco2s,\\n uint256[] amounts\\n );\\n\\n modifier onlyRedeemable(address _token) {\\n require(isRedeemable(_token), \\\"Token not redeemable.\\\");\\n\\n _;\\n }\\n\\n modifier onlySwappable(address _token) {\\n require(isSwappable(_token), \\\"Path doesn't yet exist.\\\");\\n\\n _;\\n }\\n\\n modifier isNotCelo() {\\n require(\\n block.chainid != CELO_MAINNET_CHAINID &&\\n block.chainid != ALFAJORES_MAINNET_CHAINID,\\n \\\"The function is not available on Celo.\\\"\\n );\\n\\n _;\\n }\\n\\n /**\\n * @notice Contract constructor. Should specify arrays of ERC20 symbols and\\n * addresses that can used by the contract.\\n *\\n * @dev See `isEligible()` for a list of tokens that can be used in the\\n * contract. These can be modified after deployment by the contract owner\\n * using `setEligibleTokenAddress()` and `deleteEligibleTokenAddress()`.\\n *\\n * @param _poolAddresses A list of pool token addresses.\\n * @param _tokenSymbolsForPaths An array of symbols of the token the user want to retire carbon credits for\\n * @param _paths An array of arrays of addresses to describe the path needed to swap form the baseToken to the pool Token\\n * to the provided token symbols.\\n */\\n constructor(\\n address[] memory _poolAddresses,\\n string[] memory _tokenSymbolsForPaths,\\n address[][] memory _paths,\\n address _dexRouterAddress\\n ) {\\n poolAddresses = _poolAddresses;\\n tokenSymbolsForPaths = _tokenSymbolsForPaths;\\n paths = _paths;\\n dexRouterAddress = _dexRouterAddress;\\n\\n uint256 eligibleSwapPathsBySymbolLen = _tokenSymbolsForPaths.length;\\n for (uint256 i; i < eligibleSwapPathsBySymbolLen; i++) {\\n eligibleSwapPaths[_paths[i][0]] = _paths[i];\\n eligibleSwapPathsBySymbol[_tokenSymbolsForPaths[i]] = _paths[i];\\n }\\n }\\n\\n // The receive and fallback method are needed to fix the situation where transfering dust native tokens\\n // in the native tokens to token swap fails\\n receive() external payable {}\\n\\n // ----------------------------------------\\n // Public functions\\n // ----------------------------------------\\n\\n /**\\n * @notice Retire carbon credits using the oldest TCO2\\n * tokens available from the specified Toucan token pool by sending ERC20\\n * tokens (cUSD, USDC, WETH, WMATIC). Use `calculateNeededTokenAmount` first in\\n * order to find out how much of the ERC20 token is required to retire the\\n * specified quantity of TCO2.\\n *\\n * This function:\\n * 1. Swaps the ERC20 token sent to the contract for the specified pool token.\\n * 2. Redeems the pool token for the oldest TCO2 tokens available.\\n * 3. Retires the TCO2 tokens.\\n *\\n * Note: The client must approve the ERC20 token that is sent to the contract.\\n *\\n * @dev When automatically redeeming pool tokens for the oldest ones\\n * TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool\\n * token.\\n *\\n * @param _fromToken The address of the ERC20 token that the user sends\\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\\n * @param _poolToken The address of the pool token that the\\n * user wants to use, e.g., NCT\\n * @param _amountToOffset The amount of TCO2 to offset\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetExactOutToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _amountToOffset\\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\\n // swap input token for BCT / NCT\\n swapExactOutToken(_fromToken, _poolToken, _amountToOffset);\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire carbon credits using the oldest TCO2\\n * tokens available from the specified Toucan token pool by sending ERC20\\n * tokens (cUSD, USDC, WETH, WMATIC). All provided token is consumed for\\n * offsetting. Use `calculateExpectedPoolTokenForToken()` to calculate the expected amount\\n * of Pool token that can be acquired by swapping the provided amount of ERC20 token.\\n *\\n * This function:\\n * 1. Swaps the ERC20 token sent to the contract for the specified pool token.\\n * 2. Redeems the pool token for the oldest TCO2 tokens available.\\n * 3. Retires the TCO2 tokens.\\n *\\n * Note: The client must approve the ERC20 token that is sent to the contract.\\n *\\n * @dev When automatically redeeming pool tokens for the oldest ones\\n * TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool\\n * token.\\n *\\n * @param _fromToken The address of the ERC20 token that the user sends\\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\\n * @param _poolToken The address of the pool token that the\\n * user wants to use, e.g., NCT\\n * @param _amountToSwap The amount of ERC20 token to swap into Toucan pool\\n * token. Full amount will be used for offsetting.\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetExactInToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _amountToSwap\\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\\n // swap input token for BCT / NCT\\n uint256 amountToOffset = swapExactInToken(\\n _fromToken,\\n _poolToken,\\n _amountToSwap\\n );\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire carbon credits using the oldest TCO2\\n * tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC.\\n * Use `calculateNeededETHAmount()` first in order to find out how much\\n * native tokens are required to retire the specified quantity of TCO2.\\n *\\n * This function:\\n * 1. Swaps the Matic sent to the contract for the specified pool token.\\n * 2. Redeems the pool token for the oldest TCO2 tokens available.\\n * 3. Retires the TCO2 tokens.\\n *\\n * @dev If the user sends too much native tokens , the leftover amount will be sent back\\n * to the user. This function is only available on Polygon, not on Celo.\\n *\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _amountToOffset The amount of TCO2 to offset.\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetExactOutETH(\\n address _poolToken,\\n uint256 _amountToOffset\\n )\\n public\\n payable\\n isNotCelo\\n returns (address[] memory tco2s, uint256[] memory amounts)\\n {\\n // swap native tokens for BCT / NCT\\n swapExactOutETH(_poolToken, _amountToOffset);\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire carbon credits using the oldest TCO2\\n * tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC.\\n * All provided native tokens is consumed for offsetting.\\n * Use `calculateExpectedPoolTokenForETH()` to calculate the expected amount of\\n * Pool token that can be acquired by swapping the provided amount of native tokens e.g., MATIC.\\n *\\n * This function:\\n * 1. Swaps the Matic sent to the contract for the specified pool token.\\n * 2. Redeems the pool token for the oldest TCO2 tokens available.\\n * 3. Retires the TCO2 tokens.\\n *\\n * @dev This function is only available on Polygon, not on Celo.\\n *\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetExactInETH(\\n address _poolToken\\n )\\n public\\n payable\\n isNotCelo\\n returns (address[] memory tco2s, uint256[] memory amounts)\\n {\\n // swap native tokens for BCT / NCT\\n uint256 amountToOffset = swapExactInETH(_poolToken);\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire carbon credits using the oldest TCO2\\n * tokens available by sending pool tokens, e.g., NCT.\\n *\\n * This function:\\n * 1. Redeems the pool token for the oldest TCO2 tokens available.\\n * 2. Retires the TCO2 tokens.\\n *\\n * Note: The client must approve the pool token that is sent.\\n *\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _amountToOffset The amount of TCO2 to offset.\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetPoolToken(\\n address _poolToken,\\n uint256 _amountToOffset\\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\\n // deposit pool token from user to this contract\\n IERC20(_poolToken).safeTransferFrom(\\n msg.sender,\\n address(this),\\n _amountToOffset\\n );\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Redeems the specified amount of NCT / BCT for TCO2.\\n * @dev Needs to be approved on the client side\\n * @param _fromToken Could be the address of NCT\\n * @param _amount Amount to redeem\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoRedeem(\\n address _fromToken,\\n uint256 _amount\\n )\\n public\\n onlyRedeemable(_fromToken)\\n returns (address[] memory tco2s, uint256[] memory amounts)\\n {\\n require(\\n IERC20(_fromToken).balanceOf(address(this)) >= _amount,\\n \\\"Insufficient NCT/BCT balance\\\"\\n );\\n\\n // instantiate pool token (NCT)\\n IToucanPoolToken PoolTokenImplementation = IToucanPoolToken(_fromToken);\\n\\n // auto redeem pool token for TCO2; will transfer automatically picked TCO2 to this contract\\n (tco2s, amounts) = PoolTokenImplementation.redeemAuto2(_amount);\\n\\n emit Redeemed(msg.sender, _fromToken, tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire the specified TCO2 tokens.\\n * @param _tco2s The addresses of the TCO2s to retire\\n * @param _amounts The amounts to retire from each of the corresponding\\n * TCO2 addresses\\n */\\n function autoRetire(\\n address[] memory _tco2s,\\n uint256[] memory _amounts\\n ) public {\\n uint256 tco2sLen = _tco2s.length;\\n require(tco2sLen != 0, \\\"Array empty\\\");\\n\\n require(tco2sLen == _amounts.length, \\\"Arrays unequal\\\");\\n\\n for (uint i = 0; i < tco2sLen; i++) {\\n if (_amounts[i] == 0) {\\n continue;\\n }\\n require(\\n IERC20(_tco2s[i]).balanceOf(address(this)) >= _amounts[i],\\n \\\"Insufficient TCO2 balance\\\"\\n );\\n\\n IToucanCarbonOffsets(_tco2s[i]).retire(_amounts[i]);\\n }\\n }\\n\\n /**\\n * @notice Swap eligible ERC20 tokens for pool tokens (BCT/NCT) on SushiSwap\\n * @dev Needs to be approved on the client side\\n * @param _fromToken The address of the ERC20 token used for the swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _toAmount The required amount of the pool token (NCT/BCT)\\n */\\n function swapExactOutToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _toAmount\\n ) public onlySwappable(_fromToken) onlyRedeemable(_poolToken) {\\n // calculate path & amounts\\n (\\n address[] memory path,\\n uint256[] memory expAmounts\\n ) = calculateExactOutSwap(_fromToken, _poolToken, _toAmount);\\n uint256 amountIn = expAmounts[0];\\n\\n // transfer tokens\\n IERC20(_fromToken).safeTransferFrom(\\n msg.sender,\\n address(this),\\n amountIn\\n );\\n\\n // approve router\\n IERC20(_fromToken).approve(dexRouterAddress, amountIn);\\n\\n // swap\\n uint256[] memory amounts = dexRouter().swapTokensForExactTokens(\\n _toAmount,\\n amountIn, // max. input amount\\n path,\\n address(this),\\n block.timestamp\\n );\\n\\n // remove remaining approval if less input token was consumed\\n if (amounts[0] < amountIn) {\\n IERC20(_fromToken).approve(dexRouterAddress, 0);\\n }\\n }\\n\\n /**\\n * @notice Swap eligible ERC20 tokens for pool tokens (BCT/NCT) on\\n * SushiSwap. All provided ERC20 tokens will be swapped.\\n * @dev Needs to be approved on the client side.\\n * @param _fromToken The address of the ERC20 token used for the swap\\n * @param _poolToken The address of the pool token to swap for,\\n * @param _fromAmount The amount of ERC20 token to swap\\n * e.g., NCT\\n * @return amountOut Resulting amount of pool token that got acquired for the\\n * swapped ERC20 tokens.\\n */\\n function swapExactInToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _fromAmount\\n )\\n public\\n onlySwappable(_fromToken)\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountOut)\\n {\\n // calculate path & amounts\\n address[] memory path = generatePath(_fromToken, _poolToken);\\n\\n uint256 len = path.length;\\n\\n // transfer tokens\\n IERC20(_fromToken).safeTransferFrom(\\n msg.sender,\\n address(this),\\n _fromAmount\\n );\\n\\n // approve router\\n IERC20(_fromToken).safeApprove(dexRouterAddress, _fromAmount);\\n\\n // swap\\n uint256[] memory amounts = dexRouter().swapExactTokensForTokens(\\n _fromAmount,\\n 0, // min. output amount\\n path,\\n address(this),\\n block.timestamp\\n );\\n amountOut = amounts[len - 1];\\n }\\n\\n /**\\n * @notice Swap native tokens e.g., MATIC for pool tokens (BCT/NCT) on SushiSwap.\\n * Remaining native tokens that was not consumed by the swap is returned.\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _toAmount The required amount of the pool token (NCT/BCT)\\n */\\n function swapExactOutETH(\\n address _poolToken,\\n uint256 _toAmount\\n ) public payable isNotCelo onlyRedeemable(_poolToken) {\\n // create path & amounts\\n // wrap the native token\\n address fromToken = eligibleSwapPathsBySymbol[\\\"WMATIC\\\"][0];\\n address[] memory path = generatePath(fromToken, _poolToken);\\n\\n // swap\\n uint256[] memory amounts = dexRouter().swapETHForExactTokens{\\n value: msg.value\\n }(_toAmount, path, address(this), block.timestamp);\\n\\n // send surplus back\\n if (msg.value > amounts[0]) {\\n uint256 leftoverETH = msg.value - amounts[0];\\n (bool success, ) = msg.sender.call{value: leftoverETH}(\\n new bytes(0)\\n );\\n\\n require(success, \\\"Failed to send surplus back\\\");\\n }\\n }\\n\\n /**\\n * @notice Swap native tokens e.g., MATIC for pool tokens (BCT/NCT) on SushiSwap. All\\n * provided native tokens will be swapped.\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @return amountOut Resulting amount of pool token that got acquired for the\\n * swapped native tokens .\\n */\\n function swapExactInETH(\\n address _poolToken\\n )\\n public\\n payable\\n isNotCelo\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountOut)\\n {\\n // create path & amounts\\n uint256 fromAmount = msg.value;\\n // wrap the native token\\n address fromToken = eligibleSwapPathsBySymbol[\\\"WMATIC\\\"][0];\\n address[] memory path = generatePath(fromToken, _poolToken);\\n\\n uint256 len = path.length;\\n\\n // swap\\n uint256[] memory amounts = dexRouter().swapExactETHForTokens{\\n value: fromAmount\\n }(0, path, address(this), block.timestamp);\\n amountOut = amounts[len - 1];\\n }\\n\\n // ----------------------------------------\\n // Public view functions\\n // ----------------------------------------\\n\\n /**\\n * @notice Return how much of the specified ERC20 token is required in\\n * order to swap for the desired amount of a pool token, for\\n * example, e.g., NCT.\\n *\\n * @param _fromToken The address of the ERC20 token used for the swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _toAmount The desired amount of pool token to receive\\n * @return amountIn The amount of the ERC20 token required in order to\\n * swap for the specified amount of the pool token\\n */\\n function calculateNeededTokenAmount(\\n address _fromToken,\\n address _poolToken,\\n uint256 _toAmount\\n )\\n public\\n view\\n onlySwappable(_fromToken)\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountIn)\\n {\\n (, uint256[] memory amounts) = calculateExactOutSwap(\\n _fromToken,\\n _poolToken,\\n _toAmount\\n );\\n amountIn = amounts[0];\\n }\\n\\n /**\\n * @notice Return how much native tokens e.g, MATIC is required in order to swap for the\\n * desired amount of a pool token, e.g., NCT.\\n * @param _poolToken The address of the pool token to swap for, for\\n * example, NCT\\n * @param _toAmount The desired amount of pool token to receive\\n * @return amountIn The amount of native tokens required in order to swap for\\n * the specified amount of the pool token\\n */\\n function calculateNeededETHAmount(\\n address _poolToken,\\n uint256 _toAmount\\n ) public view onlyRedeemable(_poolToken) returns (uint256 amountIn) {\\n address fromToken = eligibleSwapPathsBySymbol[\\\"WMATIC\\\"][0];\\n (, uint256[] memory amounts) = calculateExactOutSwap(\\n fromToken,\\n _poolToken,\\n _toAmount\\n );\\n amountIn = amounts[0];\\n }\\n\\n /**\\n * @notice Calculates the expected amount of pool token that can be\\n * acquired by swapping the provided amount of ERC20 token.\\n *\\n * @param _fromToken The address of the ERC20 token used for the swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _fromAmount The amount of ERC20 token to swap\\n * @return amountOut The expected amount of Pool token that can be acquired\\n */\\n function calculateExpectedPoolTokenForToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _fromAmount\\n )\\n public\\n view\\n onlySwappable(_fromToken)\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountOut)\\n {\\n (, uint256[] memory amounts) = calculateExactInSwap(\\n _fromToken,\\n _poolToken,\\n _fromAmount\\n );\\n amountOut = amounts[amounts.length - 1];\\n }\\n\\n /**\\n * @notice Calculates the expected amount of pool token that can be\\n * acquired by swapping the provided amount of native tokens e.g., MATIC.\\n *\\n * @param _fromTokenAmount The amount of native tokens to swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @return amountOut The expected amount of Pool token that can be acquired\\n */\\n function calculateExpectedPoolTokenForETH(\\n address _poolToken,\\n uint256 _fromTokenAmount\\n )\\n public\\n view\\n isNotCelo\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountOut)\\n {\\n address fromToken = eligibleSwapPathsBySymbol[\\\"WMATIC\\\"][0];\\n (, uint256[] memory amounts) = calculateExactInSwap(\\n fromToken,\\n _poolToken,\\n _fromTokenAmount\\n );\\n amountOut = amounts[amounts.length - 1];\\n }\\n\\n // ----------------------------------------\\n // Internal functions\\n // ----------------------------------------\\n\\n function calculateExactOutSwap(\\n address _fromToken,\\n address _poolToken,\\n uint256 _toAmount\\n ) internal view returns (address[] memory path, uint256[] memory amounts) {\\n // create path & calculate amounts\\n path = generatePath(_fromToken, _poolToken);\\n uint256 len = path.length;\\n\\n amounts = dexRouter().getAmountsIn(_toAmount, path);\\n\\n // sanity check arrays\\n require(len == amounts.length, \\\"Arrays unequal\\\");\\n require(_toAmount == amounts[len - 1], \\\"Output amount mismatch\\\");\\n }\\n\\n function calculateExactInSwap(\\n address _fromToken,\\n address _poolToken,\\n uint256 _fromAmount\\n ) internal view returns (address[] memory path, uint256[] memory amounts) {\\n // create path & calculate amounts\\n path = generatePath(_fromToken, _poolToken);\\n uint256 len = path.length;\\n\\n amounts = dexRouter().getAmountsOut(_fromAmount, path);\\n\\n // sanity check arrays\\n require(len == amounts.length, \\\"Arrays unequal\\\");\\n require(_fromAmount == amounts[0], \\\"Input amount mismatch\\\");\\n }\\n\\n /**\\n * @notice Show all pool token addresses that can be used to retired.\\n * @param _fromToken a list of token symbols that can be retired.\\n * @param _toToken a list of token symbols that can be retired.\\n */\\n function generatePath(\\n address _fromToken,\\n address _toToken\\n ) internal view returns (address[] memory path) {\\n uint256 len = eligibleSwapPaths[_fromToken].length;\\n if (len == 1) {\\n path = new address[](2);\\n path[0] = _fromToken;\\n path[1] = _toToken;\\n return path;\\n }\\n if (len == 2) {\\n path = new address[](3);\\n path[0] = _fromToken;\\n path[1] = eligibleSwapPaths[_fromToken][1];\\n path[2] = _toToken;\\n return path;\\n }\\n if (len == 3) {\\n path = new address[](3);\\n path[0] = _fromToken;\\n path[1] = eligibleSwapPaths[_fromToken][1];\\n path[2] = eligibleSwapPaths[_fromToken][2];\\n path[3] = _toToken;\\n return path;\\n } else {\\n path = new address[](4);\\n path[0] = _fromToken;\\n path[1] = eligibleSwapPaths[_fromToken][1];\\n path[2] = eligibleSwapPaths[_fromToken][2];\\n path[3] = eligibleSwapPaths[_fromToken][3];\\n path[4] = _toToken;\\n return path;\\n }\\n }\\n\\n function dexRouter() internal view returns (IUniswapV2Router02) {\\n return IUniswapV2Router02(dexRouterAddress);\\n }\\n\\n // ----------------------------------------\\n // Private functions\\n // ----------------------------------------\\n\\n /**\\n * @notice Checks whether an address is a pool token address\\n * @param _erc20Address address of token to be checked\\n * @return True if the address is a pool token address\\n */\\n function isRedeemable(address _erc20Address) private view returns (bool) {\\n for (uint i = 0; i < poolAddresses.length; i++) {\\n if (poolAddresses[i] == _erc20Address) {\\n return true;\\n }\\n }\\n\\n return false;\\n }\\n\\n /**\\n * @notice Checks whether an address can be used in a token swap\\n * @param _erc20Address address of token to be checked\\n * @return True if the specified address can be used in a swap\\n */\\n function isSwappable(address _erc20Address) private view returns (bool) {\\n for (uint i = 0; i < paths.length; i++) {\\n if (paths[i][0] == _erc20Address) {\\n return true;\\n }\\n }\\n\\n return false;\\n }\\n\\n // ----------------------------------------\\n // Admin methods\\n // ----------------------------------------\\n\\n /**\\n * @notice Checks if ERC20 Token is eligible for Offsetting.\\n * @param _erc20Address The address of the ERC20 token that the user sends\\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\\n * @return _path Returns the path of the token to be exchanged\\n */\\n\\n function isERC20AddressEligible(\\n address _erc20Address\\n ) public view returns (address[] memory _path) {\\n _path = eligibleSwapPaths[_erc20Address];\\n }\\n\\n /**\\n * @notice Change or add eligible paths and their addresses.\\n * @param _tokenSymbol The symbol of the token to add\\n * @param _path The path of the path to add\\n */\\n function addPath(\\n string memory _tokenSymbol,\\n address[] memory _path\\n ) public virtual onlyOwner {\\n eligibleSwapPaths[_path[0]] = _path;\\n eligibleSwapPathsBySymbol[_tokenSymbol] = _path;\\n tokenSymbolsForPaths.push(_tokenSymbol);\\n }\\n\\n /**\\n * @notice Delete eligible tokens stored in the contract.\\n * @param _tokenSymbol The symbol of the path to remove\\n */\\n function removePath(string memory _tokenSymbol) public virtual onlyOwner {\\n delete eligibleSwapPaths[eligibleSwapPathsBySymbol[_tokenSymbol][0]];\\n delete eligibleSwapPathsBySymbol[_tokenSymbol];\\n }\\n\\n /**\\n * @notice Cheks if Pool Token is eligible for Offsetting.\\n * @param _poolToken The addresses of the pool token to redeem\\n * @return _isEligible Returns if token can be redeemed\\n */\\n\\n function isPoolAddressEligible(\\n address _poolToken\\n ) public view returns (bool _isEligible) {\\n _isEligible = isRedeemable(_poolToken);\\n }\\n\\n /**\\n * @notice Change or add pool token addresses.\\n * @param _poolToken The address of the pool token to add\\n */\\n function addPoolToken(address _poolToken) public virtual onlyOwner {\\n poolAddresses.push(_poolToken);\\n }\\n\\n /**\\n * @notice Delete eligible pool token addresses stored in the contract.\\n * @param _poolToken The address of the pool token to remove\\n */\\n function removePoolToken(address _poolToken) public virtual onlyOwner {\\n for (uint256 i; i < poolAddresses.length; i++) {\\n if (poolAddresses[i] == _poolToken) {\\n poolAddresses[i] = poolAddresses[poolAddresses.length - 1];\\n poolAddresses.pop();\\n break;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf85a61eab51c68683a095be0c776a9a99bf70aa2dc5c65863176be9c17fb0c12\",\"license\":\"GPL-3.0\"},\"contracts/OffsetHelperStorage.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2022 Toucan Labs\\n//\\n// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract OffsetHelperStorage is Ownable {\\n // token symbol => token address\\n mapping(address => address[]) public eligibleSwapPaths;\\n mapping(string => address[]) public eligibleSwapPathsBySymbol;\\n\\n address[] public poolAddresses;\\n string[] public tokenSymbolsForPaths;\\n address[][] public paths;\\n address public dexRouterAddress;\\n}\\n\",\"keccak256\":\"0x6cd0dc999b167d00debeec534e1637cbefa552bdb801e672a20915b90bab20d0\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IToucanCarbonOffsets.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\\\";\\n\\nimport \\\"../types/CarbonProjectTypes.sol\\\";\\nimport \\\"../types/CarbonProjectVintageTypes.sol\\\";\\n\\ninterface IToucanCarbonOffsets is IERC20Upgradeable, IERC721Receiver {\\n function getGlobalProjectVintageIdentifiers()\\n external\\n view\\n returns (string memory, string memory);\\n\\n function getAttributes()\\n external\\n view\\n returns (ProjectData memory, VintageData memory);\\n\\n function getRemaining() external view returns (uint256 remaining);\\n\\n function getDepositCap() external view returns (uint256);\\n\\n function retire(uint256 amount) external;\\n\\n function retireFrom(address account, uint256 amount) external;\\n\\n function mintCertificateLegacy(\\n string calldata retiringEntityString,\\n address beneficiary,\\n string calldata beneficiaryString,\\n string calldata retirementMessage,\\n uint256 amount\\n ) external;\\n\\n function retireAndMintCertificate(\\n string calldata retiringEntityString,\\n address beneficiary,\\n string calldata beneficiaryString,\\n string calldata retirementMessage,\\n uint256 amount\\n ) external;\\n}\\n\",\"keccak256\":\"0x46c4ed2acd84764d0dd68c9c475e2c6ec3229a686046db48aca77ccd298d4b48\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/IToucanContractRegistry.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\npragma solidity ^0.8.0;\\n\\ninterface IToucanContractRegistry {\\n function carbonOffsetBatchesAddress() external view returns (address);\\n\\n function carbonProjectsAddress() external view returns (address);\\n\\n function carbonProjectVintagesAddress() external view returns (address);\\n\\n function toucanCarbonOffsetsFactoryAddress()\\n external\\n view\\n returns (address);\\n\\n function carbonOffsetBadgesAddress() external view returns (address);\\n\\n function checkERC20(address _address) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xa8451ff2527948e4eed26e97247b979212ccb3bd89506302b6c09ddbad392035\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/IToucanPoolToken.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\n\\ninterface IToucanPoolToken is IERC20Upgradeable {\\n function deposit(address erc20Addr, uint256 amount) external;\\n\\n function checkEligible(address erc20Addr) external view returns (bool);\\n\\n function checkAttributeMatching(address erc20Addr)\\n external\\n view\\n returns (bool);\\n\\n function calculateRedeemFees(\\n address[] memory tco2s,\\n uint256[] memory amounts\\n ) external view returns (uint256);\\n\\n function redeemMany(address[] memory tco2s, uint256[] memory amounts)\\n external;\\n\\n function redeemAuto(uint256 amount) external;\\n\\n function redeemAuto2(uint256 amount)\\n external\\n returns (address[] memory tco2s, uint256[] memory amounts);\\n\\n function getRemaining() external view returns (uint256);\\n\\n function getScoredTCO2s() external view returns (address[] memory);\\n}\\n\",\"keccak256\":\"0xef39949a81cf4ed78d789a1aac5c5860de1582be70de7435f1671931091d43a7\",\"license\":\"UNLICENSED\"},\"contracts/types/CarbonProjectTypes.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @dev CarbonProject related data and attributes\\nstruct ProjectData {\\n string projectId;\\n string standard;\\n string methodology;\\n string region;\\n string storageMethod;\\n string method;\\n string emissionType;\\n string category;\\n string uri;\\n address controller;\\n}\\n\",\"keccak256\":\"0x10d52f79d4bb8dbfe0abbb1662059d6d0193fe5794977b66aacf741451e25401\",\"license\":\"UNLICENSED\"},\"contracts/types/CarbonProjectVintageTypes.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\nstruct VintageData {\\n /// @dev A human-readable string which differentiates this from other vintages in\\n /// the same project, and helps build the corresponding TCO2 name and symbol.\\n string name;\\n uint64 startTime; // UNIX timestamp\\n uint64 endTime; // UNIX timestamp\\n uint256 projectTokenId;\\n uint64 totalVintageQuantity;\\n bool isCorsiaCompliant;\\n bool isCCPcompliant;\\n string coBenefits;\\n string correspAdjustment;\\n string additionalCertification;\\n string uri;\\n}\\n\",\"keccak256\":\"0x3a52e88a48b87f1ca3992c201f8b786ccf3aeb74796510893f8e33b33eae251b\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b5060405162003c5338038062003c538339810160408190526200003491620005df565b6200003f3362000207565b83516200005490600390602087019062000257565b5082516200006a906004906020860190620002c1565b5081516200008090600590602085019062000321565b50600680546001600160a01b0319166001600160a01b038316179055825160005b81811015620001fb57838181518110620000cb57634e487b7160e01b600052603260045260246000fd5b602002602001015160016000868481518110620000f857634e487b7160e01b600052603260045260246000fd5b60200260200101516000815181106200012157634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002090805190602001906200015e92919062000257565b508381815181106200018057634e487b7160e01b600052603260045260246000fd5b60200260200101516002868381518110620001ab57634e487b7160e01b600052603260045260246000fd5b6020026020010151604051620001c2919062000756565b90815260200160405180910390209080519060200190620001e592919062000257565b5080620001f2816200083d565b915050620000a1565b5050505050506200087b565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b828054828255906000526020600020908101928215620002af579160200282015b82811115620002af57825182546001600160a01b0319166001600160a01b0390911617825560209092019160019091019062000278565b50620002bd92915062000381565b5090565b82805482825590600052602060002090810192821562000313579160200282015b828111156200031357825180516200030291849160209091019062000398565b5091602001919060010190620002e2565b50620002bd92915062000415565b82805482825590600052602060002090810192821562000373579160200282015b828111156200037357825180516200036291849160209091019062000257565b509160200191906001019062000342565b50620002bd92915062000436565b5b80821115620002bd576000815560010162000382565b828054620003a69062000800565b90600052602060002090601f016020900481019282620003ca5760008555620002af565b82601f10620003e557805160ff1916838001178555620002af565b82800160010185558215620002af579182015b82811115620002af578251825591602001919060010190620003f8565b80821115620002bd5760006200042c828262000457565b5060010162000415565b80821115620002bd5760006200044d828262000499565b5060010162000436565b508054620004659062000800565b6000825580601f1062000476575050565b601f01602090049060005260206000209081019062000496919062000381565b50565b508054600082559060005260206000209081019062000496919062000381565b80516001600160a01b0381168114620004d157600080fd5b919050565b600082601f830112620004e7578081fd5b8151602062000500620004fa83620007a7565b62000774565b80838252828201915082860187848660051b890101111562000520578586fd5b855b8581101562000549576200053682620004b9565b8452928401929084019060010162000522565b5090979650505050505050565b600082601f83011262000567578081fd5b815160206200057a620004fa83620007a7565b80838252828201915082860187848660051b89010111156200059a578586fd5b855b85811015620005495781516001600160401b03811115620005bb578788fd5b620005cb8a87838c0101620004d6565b85525092840192908401906001016200059c565b60008060008060808587031215620005f5578384fd5b84516001600160401b03808211156200060c578586fd5b6200061a88838901620004d6565b9550602087015191508082111562000630578485fd5b818701915087601f83011262000644578485fd5b815162000655620004fa82620007a7565b80828252602082019150602085018b60208560051b880101111562000678578889fd5b885b84811015620007105781518681111562000692578a8bfd5b8701603f81018e13620006a3578a8bfd5b602081015187811115620006bb57620006bb62000865565b620006d0601f8201601f191660200162000774565b8181528f6040838501011115620006e5578c8dfd5b620006f8826020830160408601620007cd565b8652505060209384019391909101906001016200067a565b505060408a015190975093505050808211156200072b578384fd5b506200073a8782880162000556565b9250506200074b60608601620004b9565b905092959194509250565b600082516200076a818460208701620007cd565b9190910192915050565b604051601f8201601f191681016001600160401b03811182821017156200079f576200079f62000865565b604052919050565b60006001600160401b03821115620007c357620007c362000865565b5060051b60200190565b60005b83811015620007ea578181015183820152602001620007d0565b83811115620007fa576000848401525b50505050565b600181811c908216806200081557607f821691505b602082108114156200083757634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156200085e57634e487b7160e01b81526011600452602481fd5b5060010190565b634e487b7160e01b600052604160045260246000fd5b6133c8806200088b6000396000f3fe6080604052600436106101d15760003560e01c80638da5cb5b116100f7578063c0681c3d11610095578063e7f67fb111610064578063e7f67fb11461054e578063f04ad9d71461056e578063f2fde38b14610581578063feb21b9c146105a157600080fd5b8063c0681c3d146104db578063c6c53efb146104fb578063d08ec4751461051b578063d8a90c401461053b57600080fd5b8063a0cd6049116100d1578063a0cd60491461044b578063a2844a861461046b578063b4e76a861461049b578063b8baf9db146104bb57600080fd5b80638da5cb5b146103ed5780639753209d1461040b578063a09457221461042b57600080fd5b80635367cd9c1161016f578063715018a61161013e578063715018a61461037857806373200b111461038d57806382155e7e146103ad5780638474c288146103cd57600080fd5b80635367cd9c146102eb57806356a7de0d146102fe57806368d306d91461031e5780636d4565041461034b57600080fd5b80631a0fdecc116101ab5780631a0fdecc1461026a5780632e98c8141461028a57806335bab7e5146102ab5780634865b2b4146102cb57600080fd5b80631109ec99146101dd5780631357b113146102105780631661f8181461024857600080fd5b366101d857005b600080fd5b3480156101e957600080fd5b506101fd6101f8366004612ca7565b6105c1565b6040519081526020015b60405180910390f35b34801561021c57600080fd5b5061023061022b366004612ca7565b610695565b6040516001600160a01b039091168152602001610207565b34801561025457600080fd5b50610268610263366004612cd2565b6106cd565b005b34801561027657600080fd5b506101fd610285366004612c67565b61094a565b61029d610298366004612ca7565b6109dd565b6040516102079291906130a4565b3480156102b757600080fd5b506101fd6102c6366004612c67565b610a3a565b3480156102d757600080fd5b506101fd6102e6366004612c67565b610ba8565b6102686102f9366004612ca7565b610c33565b34801561030a57600080fd5b50610268610319366004612c44565b610eb9565b34801561032a57600080fd5b5061033e610339366004612c44565b611005565b6040516102079190613091565b34801561035757600080fd5b5061036b610366366004612f74565b61107b565b6040516102079190613107565b34801561038457600080fd5b50610268611127565b34801561039957600080fd5b506102306103a8366004612f31565b61113b565b3480156103b957600080fd5b5061029d6103c8366004612ca7565b611166565b3480156103d957600080fd5b506102686103e8366004612c67565b611322565b3480156103f957600080fd5b506000546001600160a01b0316610230565b34801561041757600080fd5b50610268610426366004612ea7565b6115ae565b34801561043757600080fd5b5061029d610446366004612c67565b611652565b34801561045757600080fd5b5061029d610466366004612c67565b611686565b34801561047757600080fd5b5061048b610486366004612c44565b6116b5565b6040519015158152602001610207565b3480156104a757600080fd5b506101fd6104b6366004612ca7565b6116c6565b3480156104c757600080fd5b506102686104d6366004612eda565b6117ba565b3480156104e757600080fd5b506102686104f6366004612c44565b61189f565b34801561050757600080fd5b50610230610516366004612fa4565b6118f9565b34801561052757600080fd5b5061029d610536366004612ca7565b611921565b6101fd610549366004612c44565b611939565b34801561055a57600080fd5b50600654610230906001600160a01b031681565b61029d61057c366004612c44565b611adc565b34801561058d57600080fd5b5061026861059c366004612c44565b611b3b565b3480156105ad57600080fd5b506102306105bc366004612f74565b611bb1565b6000826105cd81611bdb565b6105f25760405162461bcd60e51b81526004016105e990613171565b60405180910390fd5b6000600260405161060f9065574d4154494360d01b815260060190565b908152602001604051809103902060008154811061063d57634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b0316915061065e828787611c53565b9150508060008151811061068257634e487b7160e01b600052603260045260246000fd5b6020026020010151935050505092915050565b600160205281600052604060002081815481106106b157600080fd5b6000918252602090912001546001600160a01b03169150829050565b81518061070a5760405162461bcd60e51b815260206004820152600b60248201526a417272617920656d70747960a81b60448201526064016105e9565b8151811461072a5760405162461bcd60e51b81526004016105e9906131a0565b60005b818110156109445782818151811061075557634e487b7160e01b600052603260045260246000fd5b60200260200101516000141561076a57610932565b82818151811061078a57634e487b7160e01b600052603260045260246000fd5b60200260200101518482815181106107b257634e487b7160e01b600052603260045260246000fd5b60209081029190910101516040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b1580156107fd57600080fd5b505afa158015610811573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108359190612f8c565b10156108835760405162461bcd60e51b815260206004820152601960248201527f496e73756666696369656e742054434f322062616c616e63650000000000000060448201526064016105e9565b8381815181106108a357634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316633790cf578483815181106108d957634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b81526004016108ff91815260200190565b600060405180830381600087803b15801561091957600080fd5b505af115801561092d573d6000803e3d6000fd5b505050505b8061093c81613336565b91505061072d565b50505050565b60008361095681611d93565b6109725760405162461bcd60e51b81526004016105e99061313a565b8361097c81611bdb565b6109985760405162461bcd60e51b81526004016105e990613171565b60006109a5878787611c53565b915050806000815181106109c957634e487b7160e01b600052603260045260246000fd5b602002602001015193505050509392505050565b60608061a4ec46141580156109f4575061aef34614155b610a105760405162461bcd60e51b81526004016105e9906131c8565b610a1a8484610c33565b610a248484611166565b9092509050610a3382826106cd565b9250929050565b600083610a4681611d93565b610a625760405162461bcd60e51b81526004016105e99061313a565b83610a6c81611bdb565b610a885760405162461bcd60e51b81526004016105e990613171565b6000610a948787611e2c565b8051909150610aae6001600160a01b03891633308961242a565b600654610ac8906001600160a01b038a8116911688612495565b6000610adc6006546001600160a01b031690565b6001600160a01b03166338ed17398860008630426040518663ffffffff1660e01b8152600401610b10959493929190613227565b600060405180830381600087803b158015610b2a57600080fd5b505af1158015610b3e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b669190810190612e54565b905080610b746001846132b8565b81518110610b9257634e487b7160e01b600052603260045260246000fd5b6020026020010151955050505050509392505050565b600083610bb481611d93565b610bd05760405162461bcd60e51b81526004016105e99061313a565b83610bda81611bdb565b610bf65760405162461bcd60e51b81526004016105e990613171565b6000610c038787876125b9565b9150508060018251610c1591906132b8565b815181106109c957634e487b7160e01b600052603260045260246000fd5b61a4ec4614158015610c47575061aef34614155b610c635760405162461bcd60e51b81526004016105e9906131c8565b81610c6d81611bdb565b610c895760405162461bcd60e51b81526004016105e990613171565b60006002604051610ca69065574d4154494360d01b815260060190565b9081526020016040518091039020600081548110610cd457634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b03169150610cf48286611e2c565b90506000610d0a6006546001600160a01b031690565b6001600160a01b031663fb3bdb4134878530426040518663ffffffff1660e01b8152600401610d3c94939291906130d2565b6000604051808303818588803b158015610d5557600080fd5b505af1158015610d69573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052610d929190810190612e54565b905080600081518110610db557634e487b7160e01b600052603260045260246000fd5b6020026020010151341115610eb157600081600081518110610de757634e487b7160e01b600052603260045260246000fd5b602002602001015134610dfa91906132b8565b604080516000808252602082019283905292935033918491610e1b91613037565b60006040518083038185875af1925050503d8060008114610e58576040519150601f19603f3d011682016040523d82523d6000602084013e610e5d565b606091505b5050905080610eae5760405162461bcd60e51b815260206004820152601b60248201527f4661696c656420746f2073656e6420737572706c7573206261636b000000000060448201526064016105e9565b50505b505050505050565b610ec16126ef565b60005b60035481101561100157816001600160a01b031660038281548110610ef957634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415610fef5760038054610f24906001906132b8565b81548110610f4257634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600380546001600160a01b039092169183908110610f7c57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506003805480610fc957634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b03191690550190555050565b80610ff981613336565b915050610ec4565b5050565b6001600160a01b03811660009081526001602090815260409182902080548351818402810184019094528084526060939283018282801561106f57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611051575b50505050509050919050565b6004818154811061108b57600080fd5b9060005260206000200160009150905080546110a6906132fb565b80601f01602080910402602001604051908101604052809291908181526020018280546110d2906132fb565b801561111f5780601f106110f45761010080835404028352916020019161111f565b820191906000526020600020905b81548152906001019060200180831161110257829003601f168201915b505050505081565b61112f6126ef565b6111396000612749565b565b815160208184018101805160028252928201918501919091209190528054829081106106b157600080fd5b6060808361117381611bdb565b61118f5760405162461bcd60e51b81526004016105e990613171565b6040516370a0823160e01b815230600482015284906001600160a01b038716906370a082319060240160206040518083038186803b1580156111d057600080fd5b505afa1580156111e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112089190612f8c565b10156112565760405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e74204e43542f4243542062616c616e63650000000060448201526064016105e9565b604051634c02cad160e01b81526004810185905285906001600160a01b03821690634c02cad190602401600060405180830381600087803b15801561129a57600080fd5b505af11580156112ae573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526112d69190810190612d8e565b60405191955093507f3d29f82a20ec733db9f357c4dc1ae0ee60c572cc4b877384aa4639e4d877b18890611311903390899088908890613053565b60405180910390a150509250929050565b8261132c81611d93565b6113485760405162461bcd60e51b81526004016105e99061313a565b8261135281611bdb565b61136e5760405162461bcd60e51b81526004016105e990613171565b60008061137c878787611c53565b915091506000816000815181106113a357634e487b7160e01b600052603260045260246000fd5b602090810291909101015190506113c56001600160a01b03891633308461242a565b60065460405163095ea7b360e01b81526001600160a01b039182166004820152602481018390529089169063095ea7b390604401602060405180830381600087803b15801561141357600080fd5b505af1158015611427573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144b9190612e87565b5060006114606006546001600160a01b031690565b6001600160a01b0316638803dbee88848730426040518663ffffffff1660e01b8152600401611493959493929190613227565b600060405180830381600087803b1580156114ad57600080fd5b505af11580156114c1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526114e99190810190612e54565b9050818160008151811061150d57634e487b7160e01b600052603260045260246000fd5b602002602001015110156115a35760065460405163095ea7b360e01b81526001600160a01b03918216600482015260006024820152908a169063095ea7b390604401602060405180830381600087803b15801561156957600080fd5b505af115801561157d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a19190612e87565b505b505050505050505050565b6115b66126ef565b600160006002836040516115ca9190613037565b90815260200160405180910390206000815481106115f857634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528201929092526040018120611625916129f8565b6002816040516116359190613037565b9081526020016040518091039020600061164f91906129f8565b50565b6060806000611662868686610a3a565b905061166e8582611166565b909350915061167d83836106cd565b50935093915050565b606080611694858585611322565b61169e8484611166565b90925090506116ad82826106cd565b935093915050565b60006116c082611bdb565b92915050565b600061a4ec46141580156116dc575061aef34614155b6116f85760405162461bcd60e51b81526004016105e9906131c8565b8261170281611bdb565b61171e5760405162461bcd60e51b81526004016105e990613171565b6000600260405161173b9065574d4154494360d01b815260060190565b908152602001604051809103902060008154811061176957634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b0316915061178a8287876125b9565b915050806001825161179c91906132b8565b8151811061068257634e487b7160e01b600052603260045260246000fd5b6117c26126ef565b8060016000836000815181106117e857634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000209080519060200190611823929190612a16565b50806002836040516118359190613037565b90815260200160405180910390209080519060200190611856929190612a16565b5060048054600181018255600091909152825161189a917f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b01906020850190612a7b565b505050565b6118a76126ef565b600380546001810182556000919091527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b0319166001600160a01b0392909216919091179055565b6005828154811061190957600080fd5b9060005260206000200181815481106106b157600080fd5b606080610a1a6001600160a01b03851633308661242a565b600061a4ec461415801561194f575061aef34614155b61196b5760405162461bcd60e51b81526004016105e9906131c8565b8161197581611bdb565b6119915760405162461bcd60e51b81526004016105e990613171565b60405165574d4154494360d01b8152349060009060029060060190815260200160405180910390206000815481106119d957634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b031691506119f98287611e2c565b80519091506000611a126006546001600160a01b031690565b6001600160a01b0316637ff36ab58660008630426040518663ffffffff1660e01b8152600401611a4594939291906130d2565b6000604051808303818588803b158015611a5e57600080fd5b505af1158015611a72573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052611a9b9190810190612e54565b905080611aa96001846132b8565b81518110611ac757634e487b7160e01b600052603260045260246000fd5b60200260200101519650505050505050919050565b60608061a4ec4614158015611af3575061aef34614155b611b0f5760405162461bcd60e51b81526004016105e9906131c8565b6000611b1a84611939565b9050611b268482611166565b9093509150611b3583836106cd565b50915091565b611b436126ef565b6001600160a01b038116611ba85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105e9565b61164f81612749565b60038181548110611bc157600080fd5b6000918252602090912001546001600160a01b0316905081565b6000805b600354811015611c4a57826001600160a01b031660038281548110611c1457634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415611c385750600192915050565b80611c4281613336565b915050611bdf565b50600092915050565b606080611c608585611e2c565b8051909250611c776006546001600160a01b031690565b6001600160a01b0316631f00ca7485856040518363ffffffff1660e01b8152600401611ca492919061320e565b60006040518083038186803b158015611cbc57600080fd5b505afa158015611cd0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611cf89190810190612e54565b915081518114611d1a5760405162461bcd60e51b81526004016105e9906131a0565b81611d266001836132b8565b81518110611d4457634e487b7160e01b600052603260045260246000fd5b6020026020010151841461167d5760405162461bcd60e51b815260206004820152601660248201527509eeae8e0eae840c2dadeeadce840dad2e6dac2e8c6d60531b60448201526064016105e9565b6000805b600554811015611c4a57826001600160a01b031660058281548110611dcc57634e487b7160e01b600052603260045260246000fd5b90600052602060002001600081548110611df657634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415611e1a5750600192915050565b80611e2481613336565b915050611d97565b6001600160a01b038216600090815260016020819052604090912054606091811415611efc5760408051600280825260608201835290916020830190803683370190505091508382600081518110611e9457634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508282600181518110611ed657634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050506116c0565b806002141561202e576040805160038082526080820190925290602082016060803683370190505091508382600081518110611f4857634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505060016000856001600160a01b03166001600160a01b03168152602001908152602001600020600181548110611fad57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b031682600181518110611fec57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508282600281518110611ed657634e487b7160e01b600052603260045260246000fd5b80600314156121eb57604080516003808252608082019092529060208201606080368337019050509150838260008151811061207a57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505060016000856001600160a01b03166001600160a01b031681526020019081526020016000206001815481106120df57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260018151811061211e57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526001909152604090208054600290811061216a57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826002815181106121a957634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508282600381518110611ed657634e487b7160e01b600052603260045260246000fd5b60408051600480825260a082019092529060208201608080368337019050509150838260008151811061222e57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505060016000856001600160a01b03166001600160a01b0316815260200190815260200160002060018154811061229357634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826001815181106122d257634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526001909152604090208054600290811061231e57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260028151811061235d57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092018101919091529085166000908152600190915260409020805460039081106123a957634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826003815181106123e857634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508282600481518110611ed657634e487b7160e01b600052603260045260246000fd5b6040516001600160a01b03808516602483015283166044820152606481018290526109449085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612799565b80158061251e5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b1580156124e457600080fd5b505afa1580156124f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061251c9190612f8c565b155b6125895760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016105e9565b6040516001600160a01b03831660248201526044810182905261189a90849063095ea7b360e01b9060640161245e565b6060806125c68585611e2c565b80519092506125dd6006546001600160a01b031690565b6001600160a01b031663d06ca61f85856040518363ffffffff1660e01b815260040161260a92919061320e565b60006040518083038186803b15801561262257600080fd5b505afa158015612636573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261265e9190810190612e54565b9150815181146126805760405162461bcd60e51b81526004016105e9906131a0565b816000815181106126a157634e487b7160e01b600052603260045260246000fd5b6020026020010151841461167d5760405162461bcd60e51b8152602060048201526015602482015274092dce0eae840c2dadeeadce840dad2e6dac2e8c6d605b1b60448201526064016105e9565b6000546001600160a01b031633146111395760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105e9565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006127ee826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661286b9092919063ffffffff16565b80519091501561189a578080602001905181019061280c9190612e87565b61189a5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016105e9565b606061287a8484600085612882565b949350505050565b6060824710156128e35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016105e9565b600080866001600160a01b031685876040516128ff9190613037565b60006040518083038185875af1925050503d806000811461293c576040519150601f19603f3d011682016040523d82523d6000602084013e612941565b606091505b50915091506129528783838761295d565b979650505050505050565b606083156129c95782516129c2576001600160a01b0385163b6129c25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105e9565b508161287a565b61287a83838151156129de5781518083602001fd5b8060405162461bcd60e51b81526004016105e99190613107565b508054600082559060005260206000209081019061164f9190612aef565b828054828255906000526020600020908101928215612a6b579160200282015b82811115612a6b57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190612a36565b50612a77929150612aef565b5090565b828054612a87906132fb565b90600052602060002090601f016020900481019282612aa95760008555612a6b565b82601f10612ac257805160ff1916838001178555612a6b565b82800160010185558215612a6b579182015b82811115612a6b578251825591602001919060010190612ad4565b5b80821115612a775760008155600101612af0565b600082601f830112612b14578081fd5b81356020612b29612b2483613294565b613263565b80838252828201915082860187848660051b8901011115612b48578586fd5b855b85811015612b6f578135612b5d8161337d565b84529284019290840190600101612b4a565b5090979650505050505050565b600082601f830112612b8c578081fd5b81516020612b9c612b2483613294565b80838252828201915082860187848660051b8901011115612bbb578586fd5b855b85811015612b6f57815184529284019290840190600101612bbd565b600082601f830112612be9578081fd5b813567ffffffffffffffff811115612c0357612c03613367565b612c16601f8201601f1916602001613263565b818152846020838601011115612c2a578283fd5b816020850160208301379081016020019190915292915050565b600060208284031215612c55578081fd5b8135612c608161337d565b9392505050565b600080600060608486031215612c7b578182fd5b8335612c868161337d565b92506020840135612c968161337d565b929592945050506040919091013590565b60008060408385031215612cb9578182fd5b8235612cc48161337d565b946020939093013593505050565b60008060408385031215612ce4578182fd5b823567ffffffffffffffff80821115612cfb578384fd5b612d0786838701612b04565b9350602091508185013581811115612d1d578384fd5b85019050601f81018613612d2f578283fd5b8035612d3d612b2482613294565b80828252848201915084840189868560051b8701011115612d5c578687fd5b8694505b83851015612d7e578035835260019490940193918501918501612d60565b5080955050505050509250929050565b60008060408385031215612da0578182fd5b825167ffffffffffffffff80821115612db7578384fd5b818501915085601f830112612dca578384fd5b81516020612dda612b2483613294565b8083825282820191508286018a848660051b8901011115612df9578889fd5b8896505b84871015612e24578051612e108161337d565b835260019690960195918301918301612dfd565b5091880151919650909350505080821115612e3d578283fd5b50612e4a85828601612b7c565b9150509250929050565b600060208284031215612e65578081fd5b815167ffffffffffffffff811115612e7b578182fd5b61287a84828501612b7c565b600060208284031215612e98578081fd5b81518015158114612c60578182fd5b600060208284031215612eb8578081fd5b813567ffffffffffffffff811115612ece578182fd5b61287a84828501612bd9565b60008060408385031215612eec578182fd5b823567ffffffffffffffff80821115612f03578384fd5b612f0f86838701612bd9565b93506020850135915080821115612f24578283fd5b50612e4a85828601612b04565b60008060408385031215612f43578182fd5b823567ffffffffffffffff811115612f59578283fd5b612f6585828601612bd9565b95602094909401359450505050565b600060208284031215612f85578081fd5b5035919050565b600060208284031215612f9d578081fd5b5051919050565b60008060408385031215612fb6578182fd5b50508035926020909101359150565b6000815180845260208085019450808401835b83811015612ffd5781516001600160a01b031687529582019590820190600101612fd8565b509495945050505050565b6000815180845260208085019450808401835b83811015612ffd5781518752958201959082019060010161301b565b600082516130498184602087016132cf565b9190910192915050565b6001600160a01b0385811682528416602082015260806040820181905260009061307f90830185612fc5565b82810360608401526129528185613008565b602081526000612c606020830184612fc5565b6040815260006130b76040830185612fc5565b82810360208401526130c98185613008565b95945050505050565b8481526080602082015260006130eb6080830186612fc5565b6001600160a01b03949094166040830152506060015292915050565b60208152600082518060208401526131268160408501602087016132cf565b601f01601f19169190910160400192915050565b60208082526017908201527f5061746820646f65736e2774207965742065786973742e000000000000000000604082015260600190565b6020808252601590820152742a37b5b2b7103737ba103932b232b2b6b0b136329760591b604082015260600190565b6020808252600e908201526d105c9c985e5cc81d5b995c5d585b60921b604082015260600190565b60208082526026908201527f5468652066756e6374696f6e206973206e6f7420617661696c61626c65206f6e6040820152651021b2b6379760d11b606082015260800190565b82815260406020820152600061287a6040830184612fc5565b85815284602082015260a06040820152600061324660a0830186612fc5565b6001600160a01b0394909416606083015250608001529392505050565b604051601f8201601f1916810167ffffffffffffffff8111828210171561328c5761328c613367565b604052919050565b600067ffffffffffffffff8211156132ae576132ae613367565b5060051b60200190565b6000828210156132ca576132ca613351565b500390565b60005b838110156132ea5781810151838201526020016132d2565b838111156109445750506000910152565b600181811c9082168061330f57607f821691505b6020821081141561333057634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561334a5761334a613351565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461164f57600080fdfea2646970667358221220ddc1eff4a35a6fbb1eda6b442a738a64ebb110c6ec2e6fa36a3949ae7d1985ea64736f6c63430008040033", + "deployedBytecode": "0x6080604052600436106101d15760003560e01c80638da5cb5b116100f7578063c0681c3d11610095578063e7f67fb111610064578063e7f67fb11461054e578063f04ad9d71461056e578063f2fde38b14610581578063feb21b9c146105a157600080fd5b8063c0681c3d146104db578063c6c53efb146104fb578063d08ec4751461051b578063d8a90c401461053b57600080fd5b8063a0cd6049116100d1578063a0cd60491461044b578063a2844a861461046b578063b4e76a861461049b578063b8baf9db146104bb57600080fd5b80638da5cb5b146103ed5780639753209d1461040b578063a09457221461042b57600080fd5b80635367cd9c1161016f578063715018a61161013e578063715018a61461037857806373200b111461038d57806382155e7e146103ad5780638474c288146103cd57600080fd5b80635367cd9c146102eb57806356a7de0d146102fe57806368d306d91461031e5780636d4565041461034b57600080fd5b80631a0fdecc116101ab5780631a0fdecc1461026a5780632e98c8141461028a57806335bab7e5146102ab5780634865b2b4146102cb57600080fd5b80631109ec99146101dd5780631357b113146102105780631661f8181461024857600080fd5b366101d857005b600080fd5b3480156101e957600080fd5b506101fd6101f8366004612ca7565b6105c1565b6040519081526020015b60405180910390f35b34801561021c57600080fd5b5061023061022b366004612ca7565b610695565b6040516001600160a01b039091168152602001610207565b34801561025457600080fd5b50610268610263366004612cd2565b6106cd565b005b34801561027657600080fd5b506101fd610285366004612c67565b61094a565b61029d610298366004612ca7565b6109dd565b6040516102079291906130a4565b3480156102b757600080fd5b506101fd6102c6366004612c67565b610a3a565b3480156102d757600080fd5b506101fd6102e6366004612c67565b610ba8565b6102686102f9366004612ca7565b610c33565b34801561030a57600080fd5b50610268610319366004612c44565b610eb9565b34801561032a57600080fd5b5061033e610339366004612c44565b611005565b6040516102079190613091565b34801561035757600080fd5b5061036b610366366004612f74565b61107b565b6040516102079190613107565b34801561038457600080fd5b50610268611127565b34801561039957600080fd5b506102306103a8366004612f31565b61113b565b3480156103b957600080fd5b5061029d6103c8366004612ca7565b611166565b3480156103d957600080fd5b506102686103e8366004612c67565b611322565b3480156103f957600080fd5b506000546001600160a01b0316610230565b34801561041757600080fd5b50610268610426366004612ea7565b6115ae565b34801561043757600080fd5b5061029d610446366004612c67565b611652565b34801561045757600080fd5b5061029d610466366004612c67565b611686565b34801561047757600080fd5b5061048b610486366004612c44565b6116b5565b6040519015158152602001610207565b3480156104a757600080fd5b506101fd6104b6366004612ca7565b6116c6565b3480156104c757600080fd5b506102686104d6366004612eda565b6117ba565b3480156104e757600080fd5b506102686104f6366004612c44565b61189f565b34801561050757600080fd5b50610230610516366004612fa4565b6118f9565b34801561052757600080fd5b5061029d610536366004612ca7565b611921565b6101fd610549366004612c44565b611939565b34801561055a57600080fd5b50600654610230906001600160a01b031681565b61029d61057c366004612c44565b611adc565b34801561058d57600080fd5b5061026861059c366004612c44565b611b3b565b3480156105ad57600080fd5b506102306105bc366004612f74565b611bb1565b6000826105cd81611bdb565b6105f25760405162461bcd60e51b81526004016105e990613171565b60405180910390fd5b6000600260405161060f9065574d4154494360d01b815260060190565b908152602001604051809103902060008154811061063d57634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b0316915061065e828787611c53565b9150508060008151811061068257634e487b7160e01b600052603260045260246000fd5b6020026020010151935050505092915050565b600160205281600052604060002081815481106106b157600080fd5b6000918252602090912001546001600160a01b03169150829050565b81518061070a5760405162461bcd60e51b815260206004820152600b60248201526a417272617920656d70747960a81b60448201526064016105e9565b8151811461072a5760405162461bcd60e51b81526004016105e9906131a0565b60005b818110156109445782818151811061075557634e487b7160e01b600052603260045260246000fd5b60200260200101516000141561076a57610932565b82818151811061078a57634e487b7160e01b600052603260045260246000fd5b60200260200101518482815181106107b257634e487b7160e01b600052603260045260246000fd5b60209081029190910101516040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b1580156107fd57600080fd5b505afa158015610811573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108359190612f8c565b10156108835760405162461bcd60e51b815260206004820152601960248201527f496e73756666696369656e742054434f322062616c616e63650000000000000060448201526064016105e9565b8381815181106108a357634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316633790cf578483815181106108d957634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b81526004016108ff91815260200190565b600060405180830381600087803b15801561091957600080fd5b505af115801561092d573d6000803e3d6000fd5b505050505b8061093c81613336565b91505061072d565b50505050565b60008361095681611d93565b6109725760405162461bcd60e51b81526004016105e99061313a565b8361097c81611bdb565b6109985760405162461bcd60e51b81526004016105e990613171565b60006109a5878787611c53565b915050806000815181106109c957634e487b7160e01b600052603260045260246000fd5b602002602001015193505050509392505050565b60608061a4ec46141580156109f4575061aef34614155b610a105760405162461bcd60e51b81526004016105e9906131c8565b610a1a8484610c33565b610a248484611166565b9092509050610a3382826106cd565b9250929050565b600083610a4681611d93565b610a625760405162461bcd60e51b81526004016105e99061313a565b83610a6c81611bdb565b610a885760405162461bcd60e51b81526004016105e990613171565b6000610a948787611e2c565b8051909150610aae6001600160a01b03891633308961242a565b600654610ac8906001600160a01b038a8116911688612495565b6000610adc6006546001600160a01b031690565b6001600160a01b03166338ed17398860008630426040518663ffffffff1660e01b8152600401610b10959493929190613227565b600060405180830381600087803b158015610b2a57600080fd5b505af1158015610b3e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b669190810190612e54565b905080610b746001846132b8565b81518110610b9257634e487b7160e01b600052603260045260246000fd5b6020026020010151955050505050509392505050565b600083610bb481611d93565b610bd05760405162461bcd60e51b81526004016105e99061313a565b83610bda81611bdb565b610bf65760405162461bcd60e51b81526004016105e990613171565b6000610c038787876125b9565b9150508060018251610c1591906132b8565b815181106109c957634e487b7160e01b600052603260045260246000fd5b61a4ec4614158015610c47575061aef34614155b610c635760405162461bcd60e51b81526004016105e9906131c8565b81610c6d81611bdb565b610c895760405162461bcd60e51b81526004016105e990613171565b60006002604051610ca69065574d4154494360d01b815260060190565b9081526020016040518091039020600081548110610cd457634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b03169150610cf48286611e2c565b90506000610d0a6006546001600160a01b031690565b6001600160a01b031663fb3bdb4134878530426040518663ffffffff1660e01b8152600401610d3c94939291906130d2565b6000604051808303818588803b158015610d5557600080fd5b505af1158015610d69573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052610d929190810190612e54565b905080600081518110610db557634e487b7160e01b600052603260045260246000fd5b6020026020010151341115610eb157600081600081518110610de757634e487b7160e01b600052603260045260246000fd5b602002602001015134610dfa91906132b8565b604080516000808252602082019283905292935033918491610e1b91613037565b60006040518083038185875af1925050503d8060008114610e58576040519150601f19603f3d011682016040523d82523d6000602084013e610e5d565b606091505b5050905080610eae5760405162461bcd60e51b815260206004820152601b60248201527f4661696c656420746f2073656e6420737572706c7573206261636b000000000060448201526064016105e9565b50505b505050505050565b610ec16126ef565b60005b60035481101561100157816001600160a01b031660038281548110610ef957634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415610fef5760038054610f24906001906132b8565b81548110610f4257634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600380546001600160a01b039092169183908110610f7c57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506003805480610fc957634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b03191690550190555050565b80610ff981613336565b915050610ec4565b5050565b6001600160a01b03811660009081526001602090815260409182902080548351818402810184019094528084526060939283018282801561106f57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611051575b50505050509050919050565b6004818154811061108b57600080fd5b9060005260206000200160009150905080546110a6906132fb565b80601f01602080910402602001604051908101604052809291908181526020018280546110d2906132fb565b801561111f5780601f106110f45761010080835404028352916020019161111f565b820191906000526020600020905b81548152906001019060200180831161110257829003601f168201915b505050505081565b61112f6126ef565b6111396000612749565b565b815160208184018101805160028252928201918501919091209190528054829081106106b157600080fd5b6060808361117381611bdb565b61118f5760405162461bcd60e51b81526004016105e990613171565b6040516370a0823160e01b815230600482015284906001600160a01b038716906370a082319060240160206040518083038186803b1580156111d057600080fd5b505afa1580156111e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112089190612f8c565b10156112565760405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e74204e43542f4243542062616c616e63650000000060448201526064016105e9565b604051634c02cad160e01b81526004810185905285906001600160a01b03821690634c02cad190602401600060405180830381600087803b15801561129a57600080fd5b505af11580156112ae573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526112d69190810190612d8e565b60405191955093507f3d29f82a20ec733db9f357c4dc1ae0ee60c572cc4b877384aa4639e4d877b18890611311903390899088908890613053565b60405180910390a150509250929050565b8261132c81611d93565b6113485760405162461bcd60e51b81526004016105e99061313a565b8261135281611bdb565b61136e5760405162461bcd60e51b81526004016105e990613171565b60008061137c878787611c53565b915091506000816000815181106113a357634e487b7160e01b600052603260045260246000fd5b602090810291909101015190506113c56001600160a01b03891633308461242a565b60065460405163095ea7b360e01b81526001600160a01b039182166004820152602481018390529089169063095ea7b390604401602060405180830381600087803b15801561141357600080fd5b505af1158015611427573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144b9190612e87565b5060006114606006546001600160a01b031690565b6001600160a01b0316638803dbee88848730426040518663ffffffff1660e01b8152600401611493959493929190613227565b600060405180830381600087803b1580156114ad57600080fd5b505af11580156114c1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526114e99190810190612e54565b9050818160008151811061150d57634e487b7160e01b600052603260045260246000fd5b602002602001015110156115a35760065460405163095ea7b360e01b81526001600160a01b03918216600482015260006024820152908a169063095ea7b390604401602060405180830381600087803b15801561156957600080fd5b505af115801561157d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a19190612e87565b505b505050505050505050565b6115b66126ef565b600160006002836040516115ca9190613037565b90815260200160405180910390206000815481106115f857634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528201929092526040018120611625916129f8565b6002816040516116359190613037565b9081526020016040518091039020600061164f91906129f8565b50565b6060806000611662868686610a3a565b905061166e8582611166565b909350915061167d83836106cd565b50935093915050565b606080611694858585611322565b61169e8484611166565b90925090506116ad82826106cd565b935093915050565b60006116c082611bdb565b92915050565b600061a4ec46141580156116dc575061aef34614155b6116f85760405162461bcd60e51b81526004016105e9906131c8565b8261170281611bdb565b61171e5760405162461bcd60e51b81526004016105e990613171565b6000600260405161173b9065574d4154494360d01b815260060190565b908152602001604051809103902060008154811061176957634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b0316915061178a8287876125b9565b915050806001825161179c91906132b8565b8151811061068257634e487b7160e01b600052603260045260246000fd5b6117c26126ef565b8060016000836000815181106117e857634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000209080519060200190611823929190612a16565b50806002836040516118359190613037565b90815260200160405180910390209080519060200190611856929190612a16565b5060048054600181018255600091909152825161189a917f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b01906020850190612a7b565b505050565b6118a76126ef565b600380546001810182556000919091527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b0319166001600160a01b0392909216919091179055565b6005828154811061190957600080fd5b9060005260206000200181815481106106b157600080fd5b606080610a1a6001600160a01b03851633308661242a565b600061a4ec461415801561194f575061aef34614155b61196b5760405162461bcd60e51b81526004016105e9906131c8565b8161197581611bdb565b6119915760405162461bcd60e51b81526004016105e990613171565b60405165574d4154494360d01b8152349060009060029060060190815260200160405180910390206000815481106119d957634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b031691506119f98287611e2c565b80519091506000611a126006546001600160a01b031690565b6001600160a01b0316637ff36ab58660008630426040518663ffffffff1660e01b8152600401611a4594939291906130d2565b6000604051808303818588803b158015611a5e57600080fd5b505af1158015611a72573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052611a9b9190810190612e54565b905080611aa96001846132b8565b81518110611ac757634e487b7160e01b600052603260045260246000fd5b60200260200101519650505050505050919050565b60608061a4ec4614158015611af3575061aef34614155b611b0f5760405162461bcd60e51b81526004016105e9906131c8565b6000611b1a84611939565b9050611b268482611166565b9093509150611b3583836106cd565b50915091565b611b436126ef565b6001600160a01b038116611ba85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105e9565b61164f81612749565b60038181548110611bc157600080fd5b6000918252602090912001546001600160a01b0316905081565b6000805b600354811015611c4a57826001600160a01b031660038281548110611c1457634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415611c385750600192915050565b80611c4281613336565b915050611bdf565b50600092915050565b606080611c608585611e2c565b8051909250611c776006546001600160a01b031690565b6001600160a01b0316631f00ca7485856040518363ffffffff1660e01b8152600401611ca492919061320e565b60006040518083038186803b158015611cbc57600080fd5b505afa158015611cd0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611cf89190810190612e54565b915081518114611d1a5760405162461bcd60e51b81526004016105e9906131a0565b81611d266001836132b8565b81518110611d4457634e487b7160e01b600052603260045260246000fd5b6020026020010151841461167d5760405162461bcd60e51b815260206004820152601660248201527509eeae8e0eae840c2dadeeadce840dad2e6dac2e8c6d60531b60448201526064016105e9565b6000805b600554811015611c4a57826001600160a01b031660058281548110611dcc57634e487b7160e01b600052603260045260246000fd5b90600052602060002001600081548110611df657634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415611e1a5750600192915050565b80611e2481613336565b915050611d97565b6001600160a01b038216600090815260016020819052604090912054606091811415611efc5760408051600280825260608201835290916020830190803683370190505091508382600081518110611e9457634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508282600181518110611ed657634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050506116c0565b806002141561202e576040805160038082526080820190925290602082016060803683370190505091508382600081518110611f4857634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505060016000856001600160a01b03166001600160a01b03168152602001908152602001600020600181548110611fad57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b031682600181518110611fec57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508282600281518110611ed657634e487b7160e01b600052603260045260246000fd5b80600314156121eb57604080516003808252608082019092529060208201606080368337019050509150838260008151811061207a57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505060016000856001600160a01b03166001600160a01b031681526020019081526020016000206001815481106120df57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260018151811061211e57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526001909152604090208054600290811061216a57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826002815181106121a957634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508282600381518110611ed657634e487b7160e01b600052603260045260246000fd5b60408051600480825260a082019092529060208201608080368337019050509150838260008151811061222e57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505060016000856001600160a01b03166001600160a01b0316815260200190815260200160002060018154811061229357634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826001815181106122d257634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526001909152604090208054600290811061231e57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260028151811061235d57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092018101919091529085166000908152600190915260409020805460039081106123a957634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826003815181106123e857634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508282600481518110611ed657634e487b7160e01b600052603260045260246000fd5b6040516001600160a01b03808516602483015283166044820152606481018290526109449085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612799565b80158061251e5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b1580156124e457600080fd5b505afa1580156124f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061251c9190612f8c565b155b6125895760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016105e9565b6040516001600160a01b03831660248201526044810182905261189a90849063095ea7b360e01b9060640161245e565b6060806125c68585611e2c565b80519092506125dd6006546001600160a01b031690565b6001600160a01b031663d06ca61f85856040518363ffffffff1660e01b815260040161260a92919061320e565b60006040518083038186803b15801561262257600080fd5b505afa158015612636573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261265e9190810190612e54565b9150815181146126805760405162461bcd60e51b81526004016105e9906131a0565b816000815181106126a157634e487b7160e01b600052603260045260246000fd5b6020026020010151841461167d5760405162461bcd60e51b8152602060048201526015602482015274092dce0eae840c2dadeeadce840dad2e6dac2e8c6d605b1b60448201526064016105e9565b6000546001600160a01b031633146111395760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105e9565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006127ee826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661286b9092919063ffffffff16565b80519091501561189a578080602001905181019061280c9190612e87565b61189a5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016105e9565b606061287a8484600085612882565b949350505050565b6060824710156128e35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016105e9565b600080866001600160a01b031685876040516128ff9190613037565b60006040518083038185875af1925050503d806000811461293c576040519150601f19603f3d011682016040523d82523d6000602084013e612941565b606091505b50915091506129528783838761295d565b979650505050505050565b606083156129c95782516129c2576001600160a01b0385163b6129c25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105e9565b508161287a565b61287a83838151156129de5781518083602001fd5b8060405162461bcd60e51b81526004016105e99190613107565b508054600082559060005260206000209081019061164f9190612aef565b828054828255906000526020600020908101928215612a6b579160200282015b82811115612a6b57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190612a36565b50612a77929150612aef565b5090565b828054612a87906132fb565b90600052602060002090601f016020900481019282612aa95760008555612a6b565b82601f10612ac257805160ff1916838001178555612a6b565b82800160010185558215612a6b579182015b82811115612a6b578251825591602001919060010190612ad4565b5b80821115612a775760008155600101612af0565b600082601f830112612b14578081fd5b81356020612b29612b2483613294565b613263565b80838252828201915082860187848660051b8901011115612b48578586fd5b855b85811015612b6f578135612b5d8161337d565b84529284019290840190600101612b4a565b5090979650505050505050565b600082601f830112612b8c578081fd5b81516020612b9c612b2483613294565b80838252828201915082860187848660051b8901011115612bbb578586fd5b855b85811015612b6f57815184529284019290840190600101612bbd565b600082601f830112612be9578081fd5b813567ffffffffffffffff811115612c0357612c03613367565b612c16601f8201601f1916602001613263565b818152846020838601011115612c2a578283fd5b816020850160208301379081016020019190915292915050565b600060208284031215612c55578081fd5b8135612c608161337d565b9392505050565b600080600060608486031215612c7b578182fd5b8335612c868161337d565b92506020840135612c968161337d565b929592945050506040919091013590565b60008060408385031215612cb9578182fd5b8235612cc48161337d565b946020939093013593505050565b60008060408385031215612ce4578182fd5b823567ffffffffffffffff80821115612cfb578384fd5b612d0786838701612b04565b9350602091508185013581811115612d1d578384fd5b85019050601f81018613612d2f578283fd5b8035612d3d612b2482613294565b80828252848201915084840189868560051b8701011115612d5c578687fd5b8694505b83851015612d7e578035835260019490940193918501918501612d60565b5080955050505050509250929050565b60008060408385031215612da0578182fd5b825167ffffffffffffffff80821115612db7578384fd5b818501915085601f830112612dca578384fd5b81516020612dda612b2483613294565b8083825282820191508286018a848660051b8901011115612df9578889fd5b8896505b84871015612e24578051612e108161337d565b835260019690960195918301918301612dfd565b5091880151919650909350505080821115612e3d578283fd5b50612e4a85828601612b7c565b9150509250929050565b600060208284031215612e65578081fd5b815167ffffffffffffffff811115612e7b578182fd5b61287a84828501612b7c565b600060208284031215612e98578081fd5b81518015158114612c60578182fd5b600060208284031215612eb8578081fd5b813567ffffffffffffffff811115612ece578182fd5b61287a84828501612bd9565b60008060408385031215612eec578182fd5b823567ffffffffffffffff80821115612f03578384fd5b612f0f86838701612bd9565b93506020850135915080821115612f24578283fd5b50612e4a85828601612b04565b60008060408385031215612f43578182fd5b823567ffffffffffffffff811115612f59578283fd5b612f6585828601612bd9565b95602094909401359450505050565b600060208284031215612f85578081fd5b5035919050565b600060208284031215612f9d578081fd5b5051919050565b60008060408385031215612fb6578182fd5b50508035926020909101359150565b6000815180845260208085019450808401835b83811015612ffd5781516001600160a01b031687529582019590820190600101612fd8565b509495945050505050565b6000815180845260208085019450808401835b83811015612ffd5781518752958201959082019060010161301b565b600082516130498184602087016132cf565b9190910192915050565b6001600160a01b0385811682528416602082015260806040820181905260009061307f90830185612fc5565b82810360608401526129528185613008565b602081526000612c606020830184612fc5565b6040815260006130b76040830185612fc5565b82810360208401526130c98185613008565b95945050505050565b8481526080602082015260006130eb6080830186612fc5565b6001600160a01b03949094166040830152506060015292915050565b60208152600082518060208401526131268160408501602087016132cf565b601f01601f19169190910160400192915050565b60208082526017908201527f5061746820646f65736e2774207965742065786973742e000000000000000000604082015260600190565b6020808252601590820152742a37b5b2b7103737ba103932b232b2b6b0b136329760591b604082015260600190565b6020808252600e908201526d105c9c985e5cc81d5b995c5d585b60921b604082015260600190565b60208082526026908201527f5468652066756e6374696f6e206973206e6f7420617661696c61626c65206f6e6040820152651021b2b6379760d11b606082015260800190565b82815260406020820152600061287a6040830184612fc5565b85815284602082015260a06040820152600061324660a0830186612fc5565b6001600160a01b0394909416606083015250608001529392505050565b604051601f8201601f1916810167ffffffffffffffff8111828210171561328c5761328c613367565b604052919050565b600067ffffffffffffffff8211156132ae576132ae613367565b5060051b60200190565b6000828210156132ca576132ca613351565b500390565b60005b838110156132ea5781810151838201526020016132d2565b838111156109445750506000910152565b600181811c9082168061330f57607f821691505b6020821081141561333057634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561334a5761334a613351565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461164f57600080fdfea2646970667358221220ddc1eff4a35a6fbb1eda6b442a738a64ebb110c6ec2e6fa36a3949ae7d1985ea64736f6c63430008040033", "devdoc": { "events": { "Redeemed(address,address,address[],uint256[])": { "params": { "amounts": "An array of the amounts of each TCO2 that were redeemed", - "poolToken": "The address of the Toucan pool token used in the redemption, e.g., NCT", + "poolToken": "The address of the pool token used in the redemption, e.g., NCT", "sender": "The sender of the transaction", "tco2s": "An array of the TCO2 addresses that were redeemed" } @@ -894,7 +825,7 @@ "autoOffsetExactInETH(address)": { "details": "This function is only available on Polygon, not on Celo.", "params": { - "_poolToken": "The address of the pool token to offset, e.g., NCT" + "_poolToken": "The address of the pool token to swap for, e.g., NCT" }, "returns": { "amounts": "An array of the amounts of each TCO2 that were redeemed", @@ -902,11 +833,11 @@ } }, "autoOffsetExactInToken(address,address,uint256)": { - "details": "When automatically redeeming pool tokens for the lowest quality TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool token.", + "details": "When automatically redeeming pool tokens for the oldest ones TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool token.", "params": { "_amountToSwap": "The amount of ERC20 token to swap into Toucan pool token. Full amount will be used for offsetting.", "_fromToken": "The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)", - "_poolToken": "The address of the pool token to offset, e.g., NCT" + "_poolToken": "The address of the pool token that the user wants to use, e.g., NCT" }, "returns": { "amounts": "An array of the amounts of each TCO2 that were redeemed", @@ -917,7 +848,7 @@ "details": "If the user sends too much native tokens , the leftover amount will be sent back to the user. This function is only available on Polygon, not on Celo.", "params": { "_amountToOffset": "The amount of TCO2 to offset.", - "_poolToken": "The address of the pool token to offset, e.g., NCT" + "_poolToken": "The address of the pool token to swap for, e.g., NCT" }, "returns": { "amounts": "An array of the amounts of each TCO2 that were redeemed", @@ -925,11 +856,11 @@ } }, "autoOffsetExactOutToken(address,address,uint256)": { - "details": "When automatically redeeming pool tokens for the lowest quality TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool token.", + "details": "When automatically redeeming pool tokens for the oldest ones TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool token.", "params": { "_amountToOffset": "The amount of TCO2 to offset", "_fromToken": "The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)", - "_poolToken": "The address of the Toucan pool token that the user wants to offset, e.g., NCT" + "_poolToken": "The address of the pool token that the user wants to use, e.g., NCT" }, "returns": { "amounts": "An array of the amounts of each TCO2 that were redeemed", @@ -939,7 +870,7 @@ "autoOffsetPoolToken(address,uint256)": { "params": { "_amountToOffset": "The amount of TCO2 to offset.", - "_poolToken": "The address of the pool token to offset, e.g., NCT" + "_poolToken": "The address of the pool token to swap for, e.g., NCT" }, "returns": { "amounts": "An array of the amounts of each TCO2 that were redeemed", @@ -984,7 +915,7 @@ }, "calculateNeededETHAmount(address,uint256)": { "params": { - "_poolToken": "The address of the pool token to swap for, e.g., NCT", + "_poolToken": "The address of the pool token to swap for, for example, NCT", "_toAmount": "The desired amount of pool token to receive" }, "returns": { @@ -1009,9 +940,6 @@ "_tokenSymbolsForPaths": "An array of symbols of the token the user want to retire carbon credits for" } }, - "deposit(address,uint256)": { - "details": "Needs to be approved" - }, "isERC20AddressEligible(address)": { "params": { "_erc20Address": "The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)" @@ -1022,10 +950,10 @@ }, "isPoolAddressEligible(address)": { "params": { - "_poolToken": "The address of the pool token to offset, e.g., NCT" + "_poolToken": "The addresses of the pool token to redeem" }, "returns": { - "_isEligible": "Returns a bool if the Pool token is eligible for offsetting" + "_isEligible": "Returns if token can be redeemed" } }, "owner()": { @@ -1049,24 +977,24 @@ "_poolToken": "The address of the pool token to swap for, e.g., NCT" }, "returns": { - "amountOut": "Resulting amount of Toucan pool token that got acquired for the swapped native tokens ." + "amountOut": "Resulting amount of pool token that got acquired for the swapped native tokens ." } }, "swapExactInToken(address,address,uint256)": { "details": "Needs to be approved on the client side.", "params": { - "_fromAmount": "The amount of ERC20 token to swap", + "_fromAmount": "The amount of ERC20 token to swap e.g., NCT", "_fromToken": "The address of the ERC20 token used for the swap", - "_poolToken": "The address of the pool token to swap for, e.g., NCT" + "_poolToken": "The address of the pool token to swap for," }, "returns": { - "amountOut": "Resulting amount of Toucan pool token that got acquired for the swapped ERC20 tokens." + "amountOut": "Resulting amount of pool token that got acquired for the swapped ERC20 tokens." } }, "swapExactOutETH(address,uint256)": { "params": { "_poolToken": "The address of the pool token to swap for, e.g., NCT", - "_toAmount": "The required amount of the Toucan pool token (NCT/BCT)" + "_toAmount": "The required amount of the pool token (NCT/BCT)" } }, "swapExactOutToken(address,address,uint256)": { @@ -1074,7 +1002,7 @@ "params": { "_fromToken": "The address of the ERC20 token used for the swap", "_poolToken": "The address of the pool token to swap for, e.g., NCT", - "_toAmount": "The required amount of the Toucan pool token (NCT/BCT)" + "_toAmount": "The required amount of the pool token (NCT/BCT)" } }, "transferOwnership(address)": { @@ -1099,19 +1027,19 @@ "notice": "Change or add pool token addresses." }, "autoOffsetExactInETH(address)": { - "notice": "Retire carbon credits using the lowest quality (oldest) TCO2 tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC. All provided native tokens is consumed for offsetting. The `view` helper function `calculateExpectedPoolTokenForETH()` can be used to calculate the expected amount of TCO2s that will be offset using `autoOffsetExactInETH()`. This function: 1. Swaps the native token e.g. MATIC sent to the contract for the specified pool token. 2. Redeems the pool token for the poorest quality TCO2 tokens available. 3. Retires the TCO2 tokens." + "notice": "Retire carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC. All provided native tokens is consumed for offsetting. Use `calculateExpectedPoolTokenForETH()` to calculate the expected amount of Pool token that can be acquired by swapping the provided amount of native tokens e.g., MATIC. This function: 1. Swaps the Matic sent to the contract for the specified pool token. 2. Redeems the pool token for the oldest TCO2 tokens available. 3. Retires the TCO2 tokens." }, "autoOffsetExactInToken(address,address,uint256)": { - "notice": "Retire carbon credits using the lowest quality (oldest) TCO2 tokens available from the specified Toucan token pool by sending ERC20 tokens (cUSD, USDC, WETH, WMATIC). All provided token is consumed for offsetting. The `view` helper function `calculateExpectedPoolTokenForToken()` can be used to calculate the expected amount of TCO2s that will be offset using `autoOffsetExactInToken()`. This function: 1. Swaps the ERC20 token sent to the contract for the specified pool token. 2. Redeems the pool token for the poorest quality TCO2 tokens available. 3. Retires the TCO2 tokens. Note: The client must approve the ERC20 token that is sent to the contract." + "notice": "Retire carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending ERC20 tokens (cUSD, USDC, WETH, WMATIC). All provided token is consumed for offsetting. Use `calculateExpectedPoolTokenForToken()` to calculate the expected amount of Pool token that can be acquired by swapping the provided amount of ERC20 token. This function: 1. Swaps the ERC20 token sent to the contract for the specified pool token. 2. Redeems the pool token for the oldest TCO2 tokens available. 3. Retires the TCO2 tokens. Note: The client must approve the ERC20 token that is sent to the contract." }, "autoOffsetExactOutETH(address,uint256)": { - "notice": "Retire carbon credits using the lowest quality (oldest) TCO2 tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC. The `view` helper function `calculateNeededETHAmount()` should be called before using `autoOffsetExactOutETH()`, to determine how much native tokens e.g., MATIC must be sent to the `OffsetHelper` contract in order to retire the specified amount of carbon. This function: 1. Swaps the native token e.g. MATIC sent to the contract for the specified pool token. 2. Redeems the pool token for the poorest quality TCO2 tokens available. 3. Retires the TCO2 tokens." + "notice": "Retire carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC. Use `calculateNeededETHAmount()` first in order to find out how much native tokens are required to retire the specified quantity of TCO2. This function: 1. Swaps the Matic sent to the contract for the specified pool token. 2. Redeems the pool token for the oldest TCO2 tokens available. 3. Retires the TCO2 tokens." }, "autoOffsetExactOutToken(address,address,uint256)": { - "notice": "Retire carbon credits using the lowest quality (oldest) TCO2 tokens available from the specified Toucan token pool by sending ERC20 tokens (cUSD, USDC, WETH, WMATIC). The `view` helper function `calculateNeededTokenAmount()` should be called before using `autoOffsetExactOutToken()`, to determine how much native tokens e.g., MATIC must be sent to the `OffsetHelper` contract in order to retire the specified amount of carbon. This function: 1. Swaps the ERC20 token sent to the contract for the specified pool token. 2. Redeems the pool token for the poorest quality TCO2 tokens available. 3. Retires the TCO2 tokens. Note: The client must approve the ERC20 token that is sent to the contract." + "notice": "Retire carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending ERC20 tokens (cUSD, USDC, WETH, WMATIC). Use `calculateNeededTokenAmount` first in order to find out how much of the ERC20 token is required to retire the specified quantity of TCO2. This function: 1. Swaps the ERC20 token sent to the contract for the specified pool token. 2. Redeems the pool token for the oldest TCO2 tokens available. 3. Retires the TCO2 tokens. Note: The client must approve the ERC20 token that is sent to the contract." }, "autoOffsetPoolToken(address,uint256)": { - "notice": "Retire carbon credits using the lowest quality (oldest) TCO2 tokens available by sending Toucan pool tokens, e.g., NCT. This function: 1. Redeems the pool token for the poorest quality TCO2 tokens available. 2. Retires the TCO2 tokens. Note: The client must approve the pool token that is sent." + "notice": "Retire carbon credits using the oldest TCO2 tokens available by sending pool tokens, e.g., NCT. This function: 1. Redeems the pool token for the oldest TCO2 tokens available. 2. Retires the TCO2 tokens. Note: The client must approve the pool token that is sent." }, "autoRedeem(address,uint256)": { "notice": "Redeems the specified amount of NCT / BCT for TCO2." @@ -1120,28 +1048,25 @@ "notice": "Retire the specified TCO2 tokens." }, "calculateExpectedPoolTokenForETH(address,uint256)": { - "notice": "Calculates the expected amount of Toucan Pool token that can be acquired by swapping the provided amount of native tokens e.g., MATIC." + "notice": "Calculates the expected amount of pool token that can be acquired by swapping the provided amount of native tokens e.g., MATIC." }, "calculateExpectedPoolTokenForToken(address,address,uint256)": { - "notice": "Calculates the expected amount of Toucan Pool token that can be acquired by swapping the provided amount of ERC20 token." + "notice": "Calculates the expected amount of pool token that can be acquired by swapping the provided amount of ERC20 token." }, "calculateNeededETHAmount(address,uint256)": { - "notice": "Return how much native tokens e.g, MATIC is required in order to swap for the desired amount of a Toucan pool token, e.g., NCT." + "notice": "Return how much native tokens e.g, MATIC is required in order to swap for the desired amount of a pool token, e.g., NCT." }, "calculateNeededTokenAmount(address,address,uint256)": { - "notice": "Return how much of the specified ERC20 token is required in order to swap for the desired amount of a Toucan pool token, for example, e.g., NCT." + "notice": "Return how much of the specified ERC20 token is required in order to swap for the desired amount of a pool token, for example, e.g., NCT." }, "constructor": { "notice": "Contract constructor. Should specify arrays of ERC20 symbols and addresses that can used by the contract." }, - "deposit(address,uint256)": { - "notice": "Allow users to deposit BCT / NCT." - }, "isERC20AddressEligible(address)": { - "notice": "Checks if ERC20 Token is eligible for swapping." + "notice": "Checks if ERC20 Token is eligible for Offsetting." }, "isPoolAddressEligible(address)": { - "notice": "Checks if Pool Address is eligible for offsetting." + "notice": "Cheks if Pool Token is eligible for Offsetting." }, "removePath(string)": { "notice": "Delete eligible tokens stored in the contract." @@ -1150,121 +1075,78 @@ "notice": "Delete eligible pool token addresses stored in the contract." }, "swapExactInETH(address)": { - "notice": "Swap native tokens e.g., MATIC for Toucan pool tokens (BCT/NCT) on SushiSwap. All provided native tokens will be swapped." + "notice": "Swap native tokens e.g., MATIC for pool tokens (BCT/NCT) on SushiSwap. All provided native tokens will be swapped." }, "swapExactInToken(address,address,uint256)": { - "notice": "Swap eligible ERC20 tokens for Toucan pool tokens (BCT/NCT) on SushiSwap. All provided ERC20 tokens will be swapped." + "notice": "Swap eligible ERC20 tokens for pool tokens (BCT/NCT) on SushiSwap. All provided ERC20 tokens will be swapped." }, "swapExactOutETH(address,uint256)": { - "notice": "Swap native tokens e.g., MATIC for Toucan pool tokens (BCT/NCT) on SushiSwap. Remaining native tokens that was not consumed by the swap is returned." + "notice": "Swap native tokens e.g., MATIC for pool tokens (BCT/NCT) on SushiSwap. Remaining native tokens that was not consumed by the swap is returned." }, "swapExactOutToken(address,address,uint256)": { - "notice": "Swap eligible ERC20 tokens for Toucan pool tokens (BCT/NCT) on SushiSwap" - }, - "withdraw(address,uint256)": { - "notice": "Allow users to withdraw tokens they have deposited." + "notice": "Swap eligible ERC20 tokens for pool tokens (BCT/NCT) on SushiSwap" } }, - "notice": "Helper functions that simplify the carbon offsetting (retirement) process. Retiring carbon tokens requires multiple steps and interactions with Toucan Protocol's main contracts: 1. Obtain a Toucan pool token e.g., NCT (by performing a token swap on a DEX). 2. Redeem the pool token for a TCO2 token. 3. Retire the TCO2 token. These steps are combined in each of the following \"auto offset\" methods implemented in `OffsetHelper` to allow a retirement within one transaction: - `autoOffsetPoolToken()` if the user already owns a Toucan pool token e.g., NCT, - `autoOffsetExactOutETH()` if the user would like to perform a retirement using native tokens e.g., MATIC, specifying the exact amount of TCO2s to retire (only on Polygon, not on Celo), - `autoOffsetExactInETH()` if the user would like to perform a retirement using native tokens, swapping all sent native tokens into TCO2s (only on Polygon, not on Celo), - `autoOffsetExactOutToken()` if the user would like to perform a retirement using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount of TCO2s to retire, - `autoOffsetExactInToken()` if the user would like to perform a retirement using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount of token to swap into TCO2s. In these methods, \"auto\" refers to the fact that these methods use `autoRedeem()` in order to automatically choose a TCO2 token corresponding to the oldest tokenized carbon project in the specfified token pool. There are no fees incurred by the user when using `autoRedeem()`, i.e., the user receives 1 TCO2 token for each pool token (BCT/NCT) redeemed. There are two `view` helper functions `calculateNeededETHAmount()` and `calculateNeededTokenAmount()` that should be called before using `autoOffsetExactOutETH()` and `autoOffsetExactOutToken()`, to determine how much native tokens e.g., MATIC, respectively how much of the ERC20 token must be sent to the `OffsetHelper` contract in order to retire the specified amount of carbon. The two `view` helper functions `calculateExpectedPoolTokenForETH()` and `calculateExpectedPoolTokenForToken()` can be used to calculate the expected amount of TCO2s that will be offset using functions `autoOffsetExactInETH()` and `autoOffsetExactInToken()`.", + "notice": "Helper functions that simplify the carbon offsetting (retirement) process. Retiring carbon tokens requires multiple steps and interactions with Toucan Protocol's main contracts: 1. Obtain a pool token e.g., NCT (by performing a token swap on a DEX). 2. Redeem the pool token for a TCO2 token. 3. Retire the TCO2 token. These steps are combined in each of the following \"auto offset\" methods implemented in `OffsetHelper` to allow a retirement within one transaction: - `autoOffsetPoolToken()` if the user already owns a Toucan pool token e.g., NCT, - `autoOffsetExactOutETH()` if the user would like to perform a retirement using native tokens e.g., MATIC, specifying the exact amount of TCO2s to retire (only on Polygon, not on Celo), - `autoOffsetExactInETH()` if the user would like to perform a retirement using native tokens, swapping all sent native tokens into TCO2s (only on Polygon, not on Celo), - `autoOffsetExactOutToken()` if the user would like to perform a retirement using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount of TCO2s to retire, - `autoOffsetExactInToken()` if the user would like to perform a retirement using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount of token to swap into TCO2s. In these methods, \"auto\" refers to the fact that these methods use `autoRedeem()` in order to automatically choose a TCO2 token corresponding to the oldest tokenized carbon project in the specfified token pool. There are no fees incurred by the user when using `autoRedeem()`, i.e., the user receives 1 TCO2 token for each pool token (BCT/NCT) redeemed. There are two `view` helper functions `calculateNeededETHAmount()` and `calculateNeededTokenAmount()` that should be called before using `autoOffsetExactOutETH()` and `autoOffsetExactOutToken()`, to determine how much native tokens e.g., MATIC, respectively how much of the ERC20 token must be sent to the `OffsetHelper` contract in order to retire the specified amount of carbon. The two `view` helper functions `calculateExpectedPoolTokenForETH()` and `calculateExpectedPoolTokenForToken()` can be used to calculate the expected amount of TCO2s that will be offset using functions `autoOffsetExactInETH()` and `autoOffsetExactInToken()`.", "version": 1 }, "storageLayout": { "storage": [ { - "astId": 138, - "contract": "contracts/OffsetHelper.sol:OffsetHelper", - "label": "_initialized", - "offset": 0, - "slot": "0", - "type": "t_uint8" - }, - { - "astId": 141, - "contract": "contracts/OffsetHelper.sol:OffsetHelper", - "label": "_initializing", - "offset": 1, - "slot": "0", - "type": "t_bool" - }, - { - "astId": 703, - "contract": "contracts/OffsetHelper.sol:OffsetHelper", - "label": "__gap", - "offset": 0, - "slot": "1", - "type": "t_array(t_uint256)50_storage" - }, - { - "astId": 10, + "astId": 2465, "contract": "contracts/OffsetHelper.sol:OffsetHelper", "label": "_owner", "offset": 0, - "slot": "51", + "slot": "0", "type": "t_address" }, { - "astId": 130, - "contract": "contracts/OffsetHelper.sol:OffsetHelper", - "label": "__gap", - "offset": 0, - "slot": "52", - "type": "t_array(t_uint256)49_storage" - }, - { - "astId": 3502, + "astId": 5229, "contract": "contracts/OffsetHelper.sol:OffsetHelper", "label": "eligibleSwapPaths", "offset": 0, - "slot": "101", + "slot": "1", "type": "t_mapping(t_address,t_array(t_address)dyn_storage)" }, { - "astId": 3507, + "astId": 5234, "contract": "contracts/OffsetHelper.sol:OffsetHelper", "label": "eligibleSwapPathsBySymbol", "offset": 0, - "slot": "102", + "slot": "2", "type": "t_mapping(t_string_memory_ptr,t_array(t_address)dyn_storage)" }, { - "astId": 3509, - "contract": "contracts/OffsetHelper.sol:OffsetHelper", - "label": "dexRouterAddress", - "offset": 0, - "slot": "103", - "type": "t_address" - }, - { - "astId": 3512, + "astId": 5237, "contract": "contracts/OffsetHelper.sol:OffsetHelper", "label": "poolAddresses", "offset": 0, - "slot": "104", + "slot": "3", "type": "t_array(t_address)dyn_storage" }, { - "astId": 3515, + "astId": 5240, "contract": "contracts/OffsetHelper.sol:OffsetHelper", "label": "tokenSymbolsForPaths", "offset": 0, - "slot": "105", + "slot": "4", "type": "t_array(t_string_storage)dyn_storage" }, { - "astId": 3519, + "astId": 5244, "contract": "contracts/OffsetHelper.sol:OffsetHelper", "label": "paths", "offset": 0, - "slot": "106", + "slot": "5", "type": "t_array(t_array(t_address)dyn_storage)dyn_storage" }, { - "astId": 3525, + "astId": 5246, "contract": "contracts/OffsetHelper.sol:OffsetHelper", - "label": "balances", + "label": "dexRouterAddress", "offset": 0, - "slot": "107", - "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + "slot": "6", + "type": "t_address" } ], "types": { @@ -1291,23 +1173,6 @@ "label": "string[]", "numberOfBytes": "32" }, - "t_array(t_uint256)49_storage": { - "base": "t_uint256", - "encoding": "inplace", - "label": "uint256[49]", - "numberOfBytes": "1568" - }, - "t_array(t_uint256)50_storage": { - "base": "t_uint256", - "encoding": "inplace", - "label": "uint256[50]", - "numberOfBytes": "1600" - }, - "t_bool": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - }, "t_mapping(t_address,t_array(t_address)dyn_storage)": { "encoding": "mapping", "key": "t_address", @@ -1315,20 +1180,6 @@ "numberOfBytes": "32", "value": "t_array(t_address)dyn_storage" }, - "t_mapping(t_address,t_mapping(t_address,t_uint256))": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => mapping(address => uint256))", - "numberOfBytes": "32", - "value": "t_mapping(t_address,t_uint256)" - }, - "t_mapping(t_address,t_uint256)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => uint256)", - "numberOfBytes": "32", - "value": "t_uint256" - }, "t_mapping(t_string_memory_ptr,t_array(t_address)dyn_storage)": { "encoding": "mapping", "key": "t_string_memory_ptr", @@ -1345,16 +1196,6 @@ "encoding": "bytes", "label": "string", "numberOfBytes": "32" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - }, - "t_uint8": { - "encoding": "inplace", - "label": "uint8", - "numberOfBytes": "1" } } } diff --git a/deployments/celo/solcInputs/75278ec65526f1e0033cc879f57dc68d.json b/deployments/celo/solcInputs/75278ec65526f1e0033cc879f57dc68d.json new file mode 100644 index 0000000..1869077 --- /dev/null +++ b/deployments/celo/solcInputs/75278ec65526f1e0033cc879f57dc68d.json @@ -0,0 +1,125 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822ProxiableUpgradeable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeaconUpgradeable {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeaconUpgradeable.sol\";\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/StorageSlotUpgradeable.sol\";\nimport \"../utils/Initializable.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967UpgradeUpgradeable is Initializable {\n function __ERC1967Upgrade_init() internal onlyInitializing {\n }\n\n function __ERC1967Upgrade_init_unchained() internal onlyInitializing {\n }\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(AddressUpgradeable.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n _functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Emitted when the beacon is upgraded.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(AddressUpgradeable.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\n }\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return AddressUpgradeable.verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Internal function that returns the initialized version. Returns `_initialized`\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Internal function that returns the initialized version. Returns `_initializing`\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../ERC1967/ERC1967UpgradeUpgradeable.sol\";\nimport \"./Initializable.sol\";\n\n/**\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\n *\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\n * `UUPSUpgradeable` with a custom implementation of upgrades.\n *\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\n *\n * _Available since v4.1._\n */\nabstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {\n function __UUPSUpgradeable_init() internal onlyInitializing {\n }\n\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\n }\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\n address private immutable __self = address(this);\n\n /**\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\n * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\n * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\n * fail.\n */\n modifier onlyProxy() {\n require(address(this) != __self, \"Function must be called through delegatecall\");\n require(_getImplementation() == __self, \"Function must be called through active proxy\");\n _;\n }\n\n /**\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\n * callable on the implementing contract but not through proxies.\n */\n modifier notDelegated() {\n require(address(this) == __self, \"UUPSUpgradeable: must not be called through delegatecall\");\n _;\n }\n\n /**\n * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\n */\n function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\n return _IMPLEMENTATION_SLOT;\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n */\n function upgradeTo(address newImplementation) external virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\n * encoded in `data`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n */\n function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, data, true);\n }\n\n /**\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\n * {upgradeTo} and {upgradeToAndCall}.\n *\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\n *\n * ```solidity\n * function _authorizeUpgrade(address) internal override onlyOwner {}\n * ```\n */\n function _authorizeUpgrade(address newImplementation) internal virtual;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlotUpgradeable {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol": { + "content": "pragma solidity >=0.6.2;\n\ninterface IUniswapV2Router01 {\n function factory() external pure returns (address);\n function WETH() external pure returns (address);\n\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint amountADesired,\n uint amountBDesired,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline\n ) external returns (uint amountA, uint amountB, uint liquidity);\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) external payable returns (uint amountToken, uint amountETH, uint liquidity);\n function removeLiquidity(\n address tokenA,\n address tokenB,\n uint liquidity,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline\n ) external returns (uint amountA, uint amountB);\n function removeLiquidityETH(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) external returns (uint amountToken, uint amountETH);\n function removeLiquidityWithPermit(\n address tokenA,\n address tokenB,\n uint liquidity,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline,\n bool approveMax, uint8 v, bytes32 r, bytes32 s\n ) external returns (uint amountA, uint amountB);\n function removeLiquidityETHWithPermit(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline,\n bool approveMax, uint8 v, bytes32 r, bytes32 s\n ) external returns (uint amountToken, uint amountETH);\n function swapExactTokensForTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external returns (uint[] memory amounts);\n function swapTokensForExactTokens(\n uint amountOut,\n uint amountInMax,\n address[] calldata path,\n address to,\n uint deadline\n ) external returns (uint[] memory amounts);\n function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)\n external\n payable\n returns (uint[] memory amounts);\n function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)\n external\n returns (uint[] memory amounts);\n function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)\n external\n returns (uint[] memory amounts);\n function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)\n external\n payable\n returns (uint[] memory amounts);\n\n function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);\n function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);\n function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);\n function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);\n function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);\n}\n" + }, + "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol": { + "content": "pragma solidity >=0.6.2;\n\nimport './IUniswapV2Router01.sol';\n\ninterface IUniswapV2Router02 is IUniswapV2Router01 {\n function removeLiquidityETHSupportingFeeOnTransferTokens(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) external returns (uint amountETH);\n function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline,\n bool approveMax, uint8 v, bytes32 r, bytes32 s\n ) external returns (uint amountETH);\n\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external payable;\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n}\n" + }, + "contracts/interfaces/IRetirementCertificates.sol": { + "content": "// SPDX-FileCopyrightText: 2021 Toucan Labs\n//\n// SPDX-License-Identifier: UNLICENSED\n\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\n\nimport \"./IToucanContractRegistry.sol\";\n\ninterface RetirementCertificates is IERC721Upgradeable {\n /// @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n function tokenURI(uint256 tokenId) external returns (string memory);\n\n /// @notice Update retirementMessage, beneficiary, and beneficiaryString of a NFT\n /// within 24h of creation. Empty values are ignored, ie., will not overwrite the\n /// existing stored values in the NFT.\n /// @param tokenId The id of the NFT to update\n /// @param beneficiary The new beneficiary to set in the NFT\n /// @param beneficiaryString The new beneficiaryString to set in the NFT\n /// @param retirementMessage The new retirementMessage to set in the NFT\n /// @dev The function can only be called by a the NFT owner\n function updateCertificate(\n uint256 tokenId,\n address beneficiary,\n string calldata beneficiaryString,\n string calldata retirementMessage\n ) external;\n}\n" + }, + "contracts/interfaces/IToucanCarbonOffsets.sol": { + "content": "// SPDX-FileCopyrightText: 2021 Toucan Labs\n//\n// SPDX-License-Identifier: UNLICENSED\n\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\n\nimport \"../types/CarbonProjectTypes.sol\";\nimport \"../types/CarbonProjectVintageTypes.sol\";\n\ninterface IToucanCarbonOffsets is IERC20Upgradeable, IERC721Receiver {\n function getGlobalProjectVintageIdentifiers()\n external\n view\n returns (string memory, string memory);\n\n function getAttributes()\n external\n view\n returns (ProjectData memory, VintageData memory);\n\n function getRemaining() external view returns (uint256 remaining);\n\n function getDepositCap() external view returns (uint256);\n\n function retire(uint256 amount) external;\n\n function retireFrom(address account, uint256 amount) external;\n\n function mintCertificateLegacy(\n string calldata retiringEntityString,\n address beneficiary,\n string calldata beneficiaryString,\n string calldata retirementMessage,\n uint256 amount\n ) external;\n\n function retireAndMintCertificate(\n string calldata retiringEntityString,\n address beneficiary,\n string calldata beneficiaryString,\n string calldata retirementMessage,\n uint256 amount\n ) external;\n}\n" + }, + "contracts/interfaces/IToucanContractRegistry.sol": { + "content": "// SPDX-FileCopyrightText: 2021 Toucan Labs\n//\n// SPDX-License-Identifier: UNLICENSED\n\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\npragma solidity ^0.8.0;\n\ninterface IToucanContractRegistry {\n function carbonOffsetBatchesAddress() external view returns (address);\n\n function carbonProjectsAddress() external view returns (address);\n\n function carbonProjectVintagesAddress() external view returns (address);\n\n function toucanCarbonOffsetsFactoryAddress()\n external\n view\n returns (address);\n\n function carbonOffsetBadgesAddress() external view returns (address);\n\n function checkERC20(address _address) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IToucanPoolToken.sol": { + "content": "// SPDX-FileCopyrightText: 2021 Toucan Labs\n//\n// SPDX-License-Identifier: UNLICENSED\n\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\ninterface IToucanPoolToken is IERC20Upgradeable {\n function deposit(address erc20Addr, uint256 amount) external;\n\n function checkEligible(address erc20Addr) external view returns (bool);\n\n function checkAttributeMatching(address erc20Addr)\n external\n view\n returns (bool);\n\n function calculateRedeemFees(\n address[] memory tco2s,\n uint256[] memory amounts\n ) external view returns (uint256);\n\n function redeemMany(address[] memory tco2s, uint256[] memory amounts)\n external;\n\n function redeemAuto(uint256 amount) external;\n\n function redeemAuto2(uint256 amount)\n external\n returns (address[] memory tco2s, uint256[] memory amounts);\n\n function getRemaining() external view returns (uint256);\n\n function getScoredTCO2s() external view returns (address[] memory);\n}\n" + }, + "contracts/OffsetHelper.sol": { + "content": "// SPDX-FileCopyrightText: 2022 Toucan Labs\n// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\";\nimport \"./OffsetHelperStorage.sol\";\nimport \"./interfaces/IToucanPoolToken.sol\";\nimport \"./interfaces/IToucanCarbonOffsets.sol\";\nimport \"./interfaces/IToucanContractRegistry.sol\";\n\n/**\n * @title Toucan Protocol Offset Helpers\n * @notice Helper functions that simplify the carbon offsetting (retirement)\n * process.\n *\n * Retiring carbon tokens requires multiple steps and interactions with\n * Toucan Protocol's main contracts:\n * 1. Obtain a pool token e.g., NCT (by performing a token\n * swap on a DEX).\n * 2. Redeem the pool token for a TCO2 token.\n * 3. Retire the TCO2 token.\n *\n * These steps are combined in each of the following \"auto offset\" methods\n * implemented in `OffsetHelper` to allow a retirement within one transaction:\n * - `autoOffsetPoolToken()` if the user already owns a Toucan pool\n * token e.g., NCT,\n * - `autoOffsetExactOutETH()` if the user would like to perform a retirement\n * using native tokens e.g., MATIC, specifying the exact amount of TCO2s to retire (only on Polygon, not on Celo),\n * - `autoOffsetExactInETH()` if the user would like to perform a retirement\n * using native tokens, swapping all sent native tokens into TCO2s (only on Polygon, not on Celo),\n * - `autoOffsetExactOutToken()` if the user would like to perform a retirement\n * using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount\n * of TCO2s to retire,\n * - `autoOffsetExactInToken()` if the user would like to perform a retirement\n * using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount\n * of token to swap into TCO2s.\n *\n * In these methods, \"auto\" refers to the fact that these methods use\n * `autoRedeem()` in order to automatically choose a TCO2 token corresponding\n * to the oldest tokenized carbon project in the specfified token pool.\n * There are no fees incurred by the user when using `autoRedeem()`, i.e., the\n * user receives 1 TCO2 token for each pool token (BCT/NCT) redeemed.\n *\n * There are two `view` helper functions `calculateNeededETHAmount()` and\n * `calculateNeededTokenAmount()` that should be called before using\n * `autoOffsetExactOutETH()` and `autoOffsetExactOutToken()`, to determine how\n * much native tokens e.g., MATIC, respectively how much of the ERC20 token must be sent to the\n * `OffsetHelper` contract in order to retire the specified amount of carbon.\n *\n * The two `view` helper functions `calculateExpectedPoolTokenForETH()` and\n * `calculateExpectedPoolTokenForToken()` can be used to calculate the\n * expected amount of TCO2s that will be offset using functions\n * `autoOffsetExactInETH()` and `autoOffsetExactInToken()`.\n */\ncontract OffsetHelper is OffsetHelperStorage {\n using SafeERC20 for IERC20;\n // As Celo allows to pay the gas fees with other tokens than the native token,\n // it's not possible ot use the swapETH (swap native tokens) functions.\n uint256 private constant CELO_MAINNET_CHAINID = 42220;\n uint256 private constant ALFAJORES_MAINNET_CHAINID = 44787;\n\n /**\n * @notice Emitted upon successful redemption of TCO2 tokens from a Toucan\n * pool token e.g., NCT.\n *\n * @param sender The sender of the transaction\n * @param poolToken The address of the pool token used in the\n * redemption, e.g., NCT\n * @param tco2s An array of the TCO2 addresses that were redeemed\n * @param amounts An array of the amounts of each TCO2 that were redeemed\n */\n event Redeemed(\n address sender,\n address poolToken,\n address[] tco2s,\n uint256[] amounts\n );\n\n modifier onlyRedeemable(address _token) {\n require(isRedeemable(_token), \"Token not redeemable.\");\n\n _;\n }\n\n modifier onlySwappable(address _token) {\n require(isSwappable(_token), \"Path doesn't yet exist.\");\n\n _;\n }\n\n modifier isNotCelo() {\n require(\n block.chainid != CELO_MAINNET_CHAINID &&\n block.chainid != ALFAJORES_MAINNET_CHAINID,\n \"The function is not available on Celo.\"\n );\n\n _;\n }\n\n /**\n * @notice Contract constructor. Should specify arrays of ERC20 symbols and\n * addresses that can used by the contract.\n *\n * @dev See `isEligible()` for a list of tokens that can be used in the\n * contract. These can be modified after deployment by the contract owner\n * using `setEligibleTokenAddress()` and `deleteEligibleTokenAddress()`.\n *\n * @param _poolAddresses A list of pool token addresses.\n * @param _tokenSymbolsForPaths An array of symbols of the token the user want to retire carbon credits for\n * @param _paths An array of arrays of addresses to describe the path needed to swap form the baseToken to the pool Token\n * to the provided token symbols.\n */\n constructor(\n address[] memory _poolAddresses,\n string[] memory _tokenSymbolsForPaths,\n address[][] memory _paths,\n address _dexRouterAddress\n ) {\n poolAddresses = _poolAddresses;\n tokenSymbolsForPaths = _tokenSymbolsForPaths;\n paths = _paths;\n dexRouterAddress = _dexRouterAddress;\n\n uint256 eligibleSwapPathsBySymbolLen = _tokenSymbolsForPaths.length;\n for (uint256 i; i < eligibleSwapPathsBySymbolLen; i++) {\n eligibleSwapPaths[_paths[i][0]] = _paths[i];\n eligibleSwapPathsBySymbol[_tokenSymbolsForPaths[i]] = _paths[i];\n }\n }\n\n // The receive and fallback method are needed to fix the situation where transfering dust native tokens\n // in the native tokens to token swap fails\n receive() external payable {}\n\n // ----------------------------------------\n // Public functions\n // ----------------------------------------\n\n /**\n * @notice Retire carbon credits using the oldest TCO2\n * tokens available from the specified Toucan token pool by sending ERC20\n * tokens (cUSD, USDC, WETH, WMATIC). Use `calculateNeededTokenAmount` first in\n * order to find out how much of the ERC20 token is required to retire the\n * specified quantity of TCO2.\n *\n * This function:\n * 1. Swaps the ERC20 token sent to the contract for the specified pool token.\n * 2. Redeems the pool token for the oldest TCO2 tokens available.\n * 3. Retires the TCO2 tokens.\n *\n * Note: The client must approve the ERC20 token that is sent to the contract.\n *\n * @dev When automatically redeeming pool tokens for the oldest ones\n * TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool\n * token.\n *\n * @param _fromToken The address of the ERC20 token that the user sends\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\n * @param _poolToken The address of the pool token that the\n * user wants to use, e.g., NCT\n * @param _amountToOffset The amount of TCO2 to offset\n *\n * @return tco2s An array of the TCO2 addresses that were redeemed\n * @return amounts An array of the amounts of each TCO2 that were redeemed\n */\n function autoOffsetExactOutToken(\n address _fromToken,\n address _poolToken,\n uint256 _amountToOffset\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\n // swap input token for BCT / NCT\n swapExactOutToken(_fromToken, _poolToken, _amountToOffset);\n\n // redeem BCT / NCT for TCO2s\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\n\n // retire the TCO2s to achieve offset\n autoRetire(tco2s, amounts);\n }\n\n /**\n * @notice Retire carbon credits using the oldest TCO2\n * tokens available from the specified Toucan token pool by sending ERC20\n * tokens (cUSD, USDC, WETH, WMATIC). All provided token is consumed for\n * offsetting. Use `calculateExpectedPoolTokenForToken()` to calculate the expected amount\n * of Pool token that can be acquired by swapping the provided amount of ERC20 token.\n *\n * This function:\n * 1. Swaps the ERC20 token sent to the contract for the specified pool token.\n * 2. Redeems the pool token for the oldest TCO2 tokens available.\n * 3. Retires the TCO2 tokens.\n *\n * Note: The client must approve the ERC20 token that is sent to the contract.\n *\n * @dev When automatically redeeming pool tokens for the oldest ones\n * TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool\n * token.\n *\n * @param _fromToken The address of the ERC20 token that the user sends\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\n * @param _poolToken The address of the pool token that the\n * user wants to use, e.g., NCT\n * @param _amountToSwap The amount of ERC20 token to swap into Toucan pool\n * token. Full amount will be used for offsetting.\n *\n * @return tco2s An array of the TCO2 addresses that were redeemed\n * @return amounts An array of the amounts of each TCO2 that were redeemed\n */\n function autoOffsetExactInToken(\n address _fromToken,\n address _poolToken,\n uint256 _amountToSwap\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\n // swap input token for BCT / NCT\n uint256 amountToOffset = swapExactInToken(\n _fromToken,\n _poolToken,\n _amountToSwap\n );\n\n // redeem BCT / NCT for TCO2s\n (tco2s, amounts) = autoRedeem(_poolToken, amountToOffset);\n\n // retire the TCO2s to achieve offset\n autoRetire(tco2s, amounts);\n }\n\n /**\n * @notice Retire carbon credits using the oldest TCO2\n * tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC.\n * Use `calculateNeededETHAmount()` first in order to find out how much\n * native tokens are required to retire the specified quantity of TCO2.\n *\n * This function:\n * 1. Swaps the Matic sent to the contract for the specified pool token.\n * 2. Redeems the pool token for the oldest TCO2 tokens available.\n * 3. Retires the TCO2 tokens.\n *\n * @dev If the user sends too much native tokens , the leftover amount will be sent back\n * to the user. This function is only available on Polygon, not on Celo.\n *\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n * @param _amountToOffset The amount of TCO2 to offset.\n *\n * @return tco2s An array of the TCO2 addresses that were redeemed\n * @return amounts An array of the amounts of each TCO2 that were redeemed\n */\n function autoOffsetExactOutETH(\n address _poolToken,\n uint256 _amountToOffset\n )\n public\n payable\n isNotCelo\n returns (address[] memory tco2s, uint256[] memory amounts)\n {\n // swap native tokens for BCT / NCT\n swapExactOutETH(_poolToken, _amountToOffset);\n\n // redeem BCT / NCT for TCO2s\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\n\n // retire the TCO2s to achieve offset\n autoRetire(tco2s, amounts);\n }\n\n /**\n * @notice Retire carbon credits using the oldest TCO2\n * tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC.\n * All provided native tokens is consumed for offsetting.\n * Use `calculateExpectedPoolTokenForETH()` to calculate the expected amount of\n * Pool token that can be acquired by swapping the provided amount of native tokens e.g., MATIC.\n *\n * This function:\n * 1. Swaps the Matic sent to the contract for the specified pool token.\n * 2. Redeems the pool token for the oldest TCO2 tokens available.\n * 3. Retires the TCO2 tokens.\n *\n * @dev This function is only available on Polygon, not on Celo.\n *\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n *\n * @return tco2s An array of the TCO2 addresses that were redeemed\n * @return amounts An array of the amounts of each TCO2 that were redeemed\n */\n function autoOffsetExactInETH(\n address _poolToken\n )\n public\n payable\n isNotCelo\n returns (address[] memory tco2s, uint256[] memory amounts)\n {\n // swap native tokens for BCT / NCT\n uint256 amountToOffset = swapExactInETH(_poolToken);\n\n // redeem BCT / NCT for TCO2s\n (tco2s, amounts) = autoRedeem(_poolToken, amountToOffset);\n\n // retire the TCO2s to achieve offset\n autoRetire(tco2s, amounts);\n }\n\n /**\n * @notice Retire carbon credits using the oldest TCO2\n * tokens available by sending pool tokens, e.g., NCT.\n *\n * This function:\n * 1. Redeems the pool token for the oldest TCO2 tokens available.\n * 2. Retires the TCO2 tokens.\n *\n * Note: The client must approve the pool token that is sent.\n *\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n * @param _amountToOffset The amount of TCO2 to offset.\n *\n * @return tco2s An array of the TCO2 addresses that were redeemed\n * @return amounts An array of the amounts of each TCO2 that were redeemed\n */\n function autoOffsetPoolToken(\n address _poolToken,\n uint256 _amountToOffset\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\n // deposit pool token from user to this contract\n IERC20(_poolToken).safeTransferFrom(\n msg.sender,\n address(this),\n _amountToOffset\n );\n\n // redeem BCT / NCT for TCO2s\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\n\n // retire the TCO2s to achieve offset\n autoRetire(tco2s, amounts);\n }\n\n /**\n * @notice Redeems the specified amount of NCT / BCT for TCO2.\n * @dev Needs to be approved on the client side\n * @param _fromToken Could be the address of NCT\n * @param _amount Amount to redeem\n * @return tco2s An array of the TCO2 addresses that were redeemed\n * @return amounts An array of the amounts of each TCO2 that were redeemed\n */\n function autoRedeem(\n address _fromToken,\n uint256 _amount\n )\n public\n onlyRedeemable(_fromToken)\n returns (address[] memory tco2s, uint256[] memory amounts)\n {\n require(\n IERC20(_fromToken).balanceOf(address(this)) >= _amount,\n \"Insufficient NCT/BCT balance\"\n );\n\n // instantiate pool token (NCT)\n IToucanPoolToken PoolTokenImplementation = IToucanPoolToken(_fromToken);\n\n // auto redeem pool token for TCO2; will transfer automatically picked TCO2 to this contract\n (tco2s, amounts) = PoolTokenImplementation.redeemAuto2(_amount);\n\n emit Redeemed(msg.sender, _fromToken, tco2s, amounts);\n }\n\n /**\n * @notice Retire the specified TCO2 tokens.\n * @param _tco2s The addresses of the TCO2s to retire\n * @param _amounts The amounts to retire from each of the corresponding\n * TCO2 addresses\n */\n function autoRetire(\n address[] memory _tco2s,\n uint256[] memory _amounts\n ) public {\n uint256 tco2sLen = _tco2s.length;\n require(tco2sLen != 0, \"Array empty\");\n\n require(tco2sLen == _amounts.length, \"Arrays unequal\");\n\n for (uint i = 0; i < tco2sLen; i++) {\n if (_amounts[i] == 0) {\n continue;\n }\n require(\n IERC20(_tco2s[i]).balanceOf(address(this)) >= _amounts[i],\n \"Insufficient TCO2 balance\"\n );\n\n IToucanCarbonOffsets(_tco2s[i]).retire(_amounts[i]);\n }\n }\n\n /**\n * @notice Swap eligible ERC20 tokens for pool tokens (BCT/NCT) on SushiSwap\n * @dev Needs to be approved on the client side\n * @param _fromToken The address of the ERC20 token used for the swap\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n * @param _toAmount The required amount of the pool token (NCT/BCT)\n */\n function swapExactOutToken(\n address _fromToken,\n address _poolToken,\n uint256 _toAmount\n ) public onlySwappable(_fromToken) onlyRedeemable(_poolToken) {\n // calculate path & amounts\n (\n address[] memory path,\n uint256[] memory expAmounts\n ) = calculateExactOutSwap(_fromToken, _poolToken, _toAmount);\n uint256 amountIn = expAmounts[0];\n\n // transfer tokens\n IERC20(_fromToken).safeTransferFrom(\n msg.sender,\n address(this),\n amountIn\n );\n\n // approve router\n IERC20(_fromToken).approve(dexRouterAddress, amountIn);\n\n // swap\n uint256[] memory amounts = dexRouter().swapTokensForExactTokens(\n _toAmount,\n amountIn, // max. input amount\n path,\n address(this),\n block.timestamp\n );\n\n // remove remaining approval if less input token was consumed\n if (amounts[0] < amountIn) {\n IERC20(_fromToken).approve(dexRouterAddress, 0);\n }\n }\n\n /**\n * @notice Swap eligible ERC20 tokens for pool tokens (BCT/NCT) on\n * SushiSwap. All provided ERC20 tokens will be swapped.\n * @dev Needs to be approved on the client side.\n * @param _fromToken The address of the ERC20 token used for the swap\n * @param _poolToken The address of the pool token to swap for,\n * @param _fromAmount The amount of ERC20 token to swap\n * e.g., NCT\n * @return amountOut Resulting amount of pool token that got acquired for the\n * swapped ERC20 tokens.\n */\n function swapExactInToken(\n address _fromToken,\n address _poolToken,\n uint256 _fromAmount\n )\n public\n onlySwappable(_fromToken)\n onlyRedeemable(_poolToken)\n returns (uint256 amountOut)\n {\n // calculate path & amounts\n address[] memory path = generatePath(_fromToken, _poolToken);\n\n uint256 len = path.length;\n\n // transfer tokens\n IERC20(_fromToken).safeTransferFrom(\n msg.sender,\n address(this),\n _fromAmount\n );\n\n // approve router\n IERC20(_fromToken).safeApprove(dexRouterAddress, _fromAmount);\n\n // swap\n uint256[] memory amounts = dexRouter().swapExactTokensForTokens(\n _fromAmount,\n 0, // min. output amount\n path,\n address(this),\n block.timestamp\n );\n amountOut = amounts[len - 1];\n }\n\n /**\n * @notice Swap native tokens e.g., MATIC for pool tokens (BCT/NCT) on SushiSwap.\n * Remaining native tokens that was not consumed by the swap is returned.\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n * @param _toAmount The required amount of the pool token (NCT/BCT)\n */\n function swapExactOutETH(\n address _poolToken,\n uint256 _toAmount\n ) public payable isNotCelo onlyRedeemable(_poolToken) {\n // create path & amounts\n // wrap the native token\n address fromToken = eligibleSwapPathsBySymbol[\"WMATIC\"][0];\n address[] memory path = generatePath(fromToken, _poolToken);\n\n // swap\n uint256[] memory amounts = dexRouter().swapETHForExactTokens{\n value: msg.value\n }(_toAmount, path, address(this), block.timestamp);\n\n // send surplus back\n if (msg.value > amounts[0]) {\n uint256 leftoverETH = msg.value - amounts[0];\n (bool success, ) = msg.sender.call{value: leftoverETH}(\n new bytes(0)\n );\n\n require(success, \"Failed to send surplus back\");\n }\n }\n\n /**\n * @notice Swap native tokens e.g., MATIC for pool tokens (BCT/NCT) on SushiSwap. All\n * provided native tokens will be swapped.\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n * @return amountOut Resulting amount of pool token that got acquired for the\n * swapped native tokens .\n */\n function swapExactInETH(\n address _poolToken\n )\n public\n payable\n isNotCelo\n onlyRedeemable(_poolToken)\n returns (uint256 amountOut)\n {\n // create path & amounts\n uint256 fromAmount = msg.value;\n // wrap the native token\n address fromToken = eligibleSwapPathsBySymbol[\"WMATIC\"][0];\n address[] memory path = generatePath(fromToken, _poolToken);\n\n uint256 len = path.length;\n\n // swap\n uint256[] memory amounts = dexRouter().swapExactETHForTokens{\n value: fromAmount\n }(0, path, address(this), block.timestamp);\n amountOut = amounts[len - 1];\n }\n\n // ----------------------------------------\n // Public view functions\n // ----------------------------------------\n\n /**\n * @notice Return how much of the specified ERC20 token is required in\n * order to swap for the desired amount of a pool token, for\n * example, e.g., NCT.\n *\n * @param _fromToken The address of the ERC20 token used for the swap\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n * @param _toAmount The desired amount of pool token to receive\n * @return amountIn The amount of the ERC20 token required in order to\n * swap for the specified amount of the pool token\n */\n function calculateNeededTokenAmount(\n address _fromToken,\n address _poolToken,\n uint256 _toAmount\n )\n public\n view\n onlySwappable(_fromToken)\n onlyRedeemable(_poolToken)\n returns (uint256 amountIn)\n {\n (, uint256[] memory amounts) = calculateExactOutSwap(\n _fromToken,\n _poolToken,\n _toAmount\n );\n amountIn = amounts[0];\n }\n\n /**\n * @notice Return how much native tokens e.g, MATIC is required in order to swap for the\n * desired amount of a pool token, e.g., NCT.\n * @param _poolToken The address of the pool token to swap for, for\n * example, NCT\n * @param _toAmount The desired amount of pool token to receive\n * @return amountIn The amount of native tokens required in order to swap for\n * the specified amount of the pool token\n */\n function calculateNeededETHAmount(\n address _poolToken,\n uint256 _toAmount\n ) public view onlyRedeemable(_poolToken) returns (uint256 amountIn) {\n address fromToken = eligibleSwapPathsBySymbol[\"WMATIC\"][0];\n (, uint256[] memory amounts) = calculateExactOutSwap(\n fromToken,\n _poolToken,\n _toAmount\n );\n amountIn = amounts[0];\n }\n\n /**\n * @notice Calculates the expected amount of pool token that can be\n * acquired by swapping the provided amount of ERC20 token.\n *\n * @param _fromToken The address of the ERC20 token used for the swap\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n * @param _fromAmount The amount of ERC20 token to swap\n * @return amountOut The expected amount of Pool token that can be acquired\n */\n function calculateExpectedPoolTokenForToken(\n address _fromToken,\n address _poolToken,\n uint256 _fromAmount\n )\n public\n view\n onlySwappable(_fromToken)\n onlyRedeemable(_poolToken)\n returns (uint256 amountOut)\n {\n (, uint256[] memory amounts) = calculateExactInSwap(\n _fromToken,\n _poolToken,\n _fromAmount\n );\n amountOut = amounts[amounts.length - 1];\n }\n\n /**\n * @notice Calculates the expected amount of pool token that can be\n * acquired by swapping the provided amount of native tokens e.g., MATIC.\n *\n * @param _fromTokenAmount The amount of native tokens to swap\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n * @return amountOut The expected amount of Pool token that can be acquired\n */\n function calculateExpectedPoolTokenForETH(\n address _poolToken,\n uint256 _fromTokenAmount\n )\n public\n view\n isNotCelo\n onlyRedeemable(_poolToken)\n returns (uint256 amountOut)\n {\n address fromToken = eligibleSwapPathsBySymbol[\"WMATIC\"][0];\n (, uint256[] memory amounts) = calculateExactInSwap(\n fromToken,\n _poolToken,\n _fromTokenAmount\n );\n amountOut = amounts[amounts.length - 1];\n }\n\n // ----------------------------------------\n // Internal functions\n // ----------------------------------------\n\n function calculateExactOutSwap(\n address _fromToken,\n address _poolToken,\n uint256 _toAmount\n ) internal view returns (address[] memory path, uint256[] memory amounts) {\n // create path & calculate amounts\n path = generatePath(_fromToken, _poolToken);\n uint256 len = path.length;\n\n amounts = dexRouter().getAmountsIn(_toAmount, path);\n\n // sanity check arrays\n require(len == amounts.length, \"Arrays unequal\");\n require(_toAmount == amounts[len - 1], \"Output amount mismatch\");\n }\n\n function calculateExactInSwap(\n address _fromToken,\n address _poolToken,\n uint256 _fromAmount\n ) internal view returns (address[] memory path, uint256[] memory amounts) {\n // create path & calculate amounts\n path = generatePath(_fromToken, _poolToken);\n uint256 len = path.length;\n\n amounts = dexRouter().getAmountsOut(_fromAmount, path);\n\n // sanity check arrays\n require(len == amounts.length, \"Arrays unequal\");\n require(_fromAmount == amounts[0], \"Input amount mismatch\");\n }\n\n /**\n * @notice Show all pool token addresses that can be used to retired.\n * @param _fromToken a list of token symbols that can be retired.\n * @param _toToken a list of token symbols that can be retired.\n */\n function generatePath(\n address _fromToken,\n address _toToken\n ) internal view returns (address[] memory path) {\n uint256 len = eligibleSwapPaths[_fromToken].length;\n if (len == 1) {\n path = new address[](2);\n path[0] = _fromToken;\n path[1] = _toToken;\n return path;\n }\n if (len == 2) {\n path = new address[](3);\n path[0] = _fromToken;\n path[1] = eligibleSwapPaths[_fromToken][1];\n path[2] = _toToken;\n return path;\n }\n if (len == 3) {\n path = new address[](3);\n path[0] = _fromToken;\n path[1] = eligibleSwapPaths[_fromToken][1];\n path[2] = eligibleSwapPaths[_fromToken][2];\n path[3] = _toToken;\n return path;\n } else {\n path = new address[](4);\n path[0] = _fromToken;\n path[1] = eligibleSwapPaths[_fromToken][1];\n path[2] = eligibleSwapPaths[_fromToken][2];\n path[3] = eligibleSwapPaths[_fromToken][3];\n path[4] = _toToken;\n return path;\n }\n }\n\n function dexRouter() internal view returns (IUniswapV2Router02) {\n return IUniswapV2Router02(dexRouterAddress);\n }\n\n // ----------------------------------------\n // Private functions\n // ----------------------------------------\n\n /**\n * @notice Checks whether an address is a pool token address\n * @param _erc20Address address of token to be checked\n * @return True if the address is a pool token address\n */\n function isRedeemable(address _erc20Address) private view returns (bool) {\n for (uint i = 0; i < poolAddresses.length; i++) {\n if (poolAddresses[i] == _erc20Address) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * @notice Checks whether an address can be used in a token swap\n * @param _erc20Address address of token to be checked\n * @return True if the specified address can be used in a swap\n */\n function isSwappable(address _erc20Address) private view returns (bool) {\n for (uint i = 0; i < paths.length; i++) {\n if (paths[i][0] == _erc20Address) {\n return true;\n }\n }\n\n return false;\n }\n\n // ----------------------------------------\n // Admin methods\n // ----------------------------------------\n\n /**\n * @notice Checks if ERC20 Token is eligible for Offsetting.\n * @param _erc20Address The address of the ERC20 token that the user sends\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\n * @return _path Returns the path of the token to be exchanged\n */\n\n function isERC20AddressEligible(\n address _erc20Address\n ) public view returns (address[] memory _path) {\n _path = eligibleSwapPaths[_erc20Address];\n }\n\n /**\n * @notice Change or add eligible paths and their addresses.\n * @param _tokenSymbol The symbol of the token to add\n * @param _path The path of the path to add\n */\n function addPath(\n string memory _tokenSymbol,\n address[] memory _path\n ) public virtual onlyOwner {\n eligibleSwapPaths[_path[0]] = _path;\n eligibleSwapPathsBySymbol[_tokenSymbol] = _path;\n tokenSymbolsForPaths.push(_tokenSymbol);\n }\n\n /**\n * @notice Delete eligible tokens stored in the contract.\n * @param _tokenSymbol The symbol of the path to remove\n */\n function removePath(string memory _tokenSymbol) public virtual onlyOwner {\n delete eligibleSwapPaths[eligibleSwapPathsBySymbol[_tokenSymbol][0]];\n delete eligibleSwapPathsBySymbol[_tokenSymbol];\n }\n\n /**\n * @notice Cheks if Pool Token is eligible for Offsetting.\n * @param _poolToken The addresses of the pool token to redeem\n * @return _isEligible Returns if token can be redeemed\n */\n\n function isPoolAddressEligible(\n address _poolToken\n ) public view returns (bool _isEligible) {\n _isEligible = isRedeemable(_poolToken);\n }\n\n /**\n * @notice Change or add pool token addresses.\n * @param _poolToken The address of the pool token to add\n */\n function addPoolToken(address _poolToken) public virtual onlyOwner {\n poolAddresses.push(_poolToken);\n }\n\n /**\n * @notice Delete eligible pool token addresses stored in the contract.\n * @param _poolToken The address of the pool token to remove\n */\n function removePoolToken(address _poolToken) public virtual onlyOwner {\n for (uint256 i; i < poolAddresses.length; i++) {\n if (poolAddresses[i] == _poolToken) {\n poolAddresses[i] = poolAddresses[poolAddresses.length - 1];\n poolAddresses.pop();\n break;\n }\n }\n }\n}\n" + }, + "contracts/OffsetHelperStorage.sol": { + "content": "// SPDX-FileCopyrightText: 2022 Toucan Labs\n//\n// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract OffsetHelperStorage is Ownable {\n // token symbol => token address\n mapping(address => address[]) public eligibleSwapPaths;\n mapping(string => address[]) public eligibleSwapPathsBySymbol;\n\n address[] public poolAddresses;\n string[] public tokenSymbolsForPaths;\n address[][] public paths;\n address public dexRouterAddress;\n}\n" + }, + "contracts/types/CarbonProjectTypes.sol": { + "content": "// SPDX-FileCopyrightText: 2021 Toucan Labs\n//\n// SPDX-License-Identifier: UNLICENSED\n\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\n\npragma solidity >=0.8.4 <0.9.0;\n\n/// @dev CarbonProject related data and attributes\nstruct ProjectData {\n string projectId;\n string standard;\n string methodology;\n string region;\n string storageMethod;\n string method;\n string emissionType;\n string category;\n string uri;\n address controller;\n}\n" + }, + "contracts/types/CarbonProjectVintageTypes.sol": { + "content": "// SPDX-FileCopyrightText: 2021 Toucan Labs\n//\n// SPDX-License-Identifier: UNLICENSED\n\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\n\npragma solidity >=0.8.4 <0.9.0;\n\nstruct VintageData {\n /// @dev A human-readable string which differentiates this from other vintages in\n /// the same project, and helps build the corresponding TCO2 name and symbol.\n string name;\n uint64 startTime; // UNIX timestamp\n uint64 endTime; // UNIX timestamp\n uint256 projectTokenId;\n uint64 totalVintageQuantity;\n bool isCorsiaCompliant;\n bool isCCPcompliant;\n string coBenefits;\n string correspAdjustment;\n string additionalCertification;\n string uri;\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/deployments/mumbai/OffsetHelper.json b/deployments/mumbai/OffsetHelper.json index 51e82a8..38168ec 100644 --- a/deployments/mumbai/OffsetHelper.json +++ b/deployments/mumbai/OffsetHelper.json @@ -1,5 +1,5 @@ { - "address": "0x9032d9D5Bc552427a698cDb021E6d1DfbbEd3e30", + "address": "0x66B1B59F9D59413dDC1539122D7d5F6b70869717", "abi": [ { "inputs": [ @@ -27,19 +27,6 @@ "stateMutability": "nonpayable", "type": "constructor" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -90,10 +77,6 @@ "name": "Redeemed", "type": "event" }, - { - "stateMutability": "payable", - "type": "fallback" - }, { "inputs": [ { @@ -322,30 +305,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "balances", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -452,24 +411,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "_erc20Addr", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "deposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [], "name": "dexRouterAddress", @@ -531,13 +472,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -786,58 +720,54 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "_erc20Addr", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "stateMutability": "payable", "type": "receive" } ], - "transactionHash": "0x2a1db3291dd23599ed3dfa9ee0f47f7d46efd61d2bb38389bd2d4bc4c23c6df2", + "transactionHash": "0x38bf7b20a353fac7b3dce7b85b32bb6d0ab9e9228cea4abe645a4f8d65fc48a9", "receipt": { "to": null, - "from": "0x101b4C436df747B24D17ce43146Da52fa6006C36", - "contractAddress": "0x9032d9D5Bc552427a698cDb021E6d1DfbbEd3e30", - "transactionIndex": 13, - "gasUsed": "3996091", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000080000800000000000000000000100000000000000000000000000000000000000000000000000000000000080000020000000000000000000200000000000000000000000000000000000000000010000000000200000000000000000000000000000000000000000000000000000002000004000000000000000000001000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000000000000100000", - "blockHash": "0x1c97634da442f9fe36e094ee76bf8760231fa00649c9eb56c597d0e08d504133", - "transactionHash": "0x2a1db3291dd23599ed3dfa9ee0f47f7d46efd61d2bb38389bd2d4bc4c23c6df2", + "from": "0xaEb6EDa99c37589667e4dEd9e1081A93307Ecc7A", + "contractAddress": "0x66B1B59F9D59413dDC1539122D7d5F6b70869717", + "transactionIndex": 1, + "gasUsed": "3721325", + "logsBloom": "0x40000000000000000000000000000000000000000000000000800000000000000000080000000000000000000000000000008000000080000000000000000000000000000000000000000000000000800001000000000000000100000000000000000000020000000000000000000800000000000000080080000000000000400000000000000000000000000000000000000000000000000000000000001000200000000000000000000000000000000000000000000020000000000000004000000000000000000001000000000000000000000000000000100000000020000008000000010000000000000000000001000000000000000000000000100000", + "blockHash": "0x966486b10ce348d03d013f5b3b412a15f394fa15253d20b800c40de7bb330027", + "transactionHash": "0x38bf7b20a353fac7b3dce7b85b32bb6d0ab9e9228cea4abe645a4f8d65fc48a9", "logs": [ { - "transactionIndex": 13, - "blockNumber": 40037685, - "transactionHash": "0x2a1db3291dd23599ed3dfa9ee0f47f7d46efd61d2bb38389bd2d4bc4c23c6df2", + "transactionIndex": 1, + "blockNumber": 41326254, + "transactionHash": "0x38bf7b20a353fac7b3dce7b85b32bb6d0ab9e9228cea4abe645a4f8d65fc48a9", + "address": "0x66B1B59F9D59413dDC1539122D7d5F6b70869717", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000aeb6eda99c37589667e4ded9e1081a93307ecc7a" + ], + "data": "0x", + "logIndex": 2, + "blockHash": "0x966486b10ce348d03d013f5b3b412a15f394fa15253d20b800c40de7bb330027" + }, + { + "transactionIndex": 1, + "blockNumber": 41326254, + "transactionHash": "0x38bf7b20a353fac7b3dce7b85b32bb6d0ab9e9228cea4abe645a4f8d65fc48a9", "address": "0x0000000000000000000000000000000000001010", "topics": [ "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", "0x0000000000000000000000000000000000000000000000000000000000001010", - "0x000000000000000000000000101b4c436df747b24d17ce43146da52fa6006c36", - "0x00000000000000000000000022b64229c41429a023549fdab3385893b579327a" + "0x000000000000000000000000aeb6eda99c37589667e4ded9e1081a93307ecc7a", + "0x000000000000000000000000e7f13f6bc1e7f5ca4a6c9a255124ce22c46f8ef0" ], - "data": "0x0000000000000000000000000000000000000000000000000020621a62967e66000000000000000000000000000000000000000000000000145ec1ee878287df000000000000000000000000000000000000000000000002ff37634594d3815a000000000000000000000000000000000000000000000000143e5fd424ec0979000000000000000000000000000000000000000000000002ff57c55ff769ffc0", - "logIndex": 120, - "blockHash": "0x1c97634da442f9fe36e094ee76bf8760231fa00649c9eb56c597d0e08d504133" + "data": "0x00000000000000000000000000000000000000000000000000421aa079980a0000000000000000000000000000000000000000000000000003fc85c7123f624500000000000000000000000000000000000000000000009e22a629fd905cc16200000000000000000000000000000000000000000000000003ba6b2698a7584500000000000000000000000000000000000000000000009e22e8449e09f4cb62", + "logIndex": 3, + "blockHash": "0x966486b10ce348d03d013f5b3b412a15f394fa15253d20b800c40de7bb330027" } ], - "blockNumber": 40037685, - "cumulativeGasUsed": "7890221", + "blockNumber": 41326254, + "cumulativeGasUsed": "3742325", "status": 1, "byzantium": true }, @@ -866,17 +796,17 @@ ], "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506" ], - "numDeployments": 4, - "solcInputHash": "9768af37541e90e4200434e6de116099", - "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_poolAddresses\",\"type\":\"address[]\"},{\"internalType\":\"string[]\",\"name\":\"_tokenSymbolsForPaths\",\"type\":\"string[]\"},{\"internalType\":\"address[][]\",\"name\":\"_paths\",\"type\":\"address[][]\"},{\"internalType\":\"address\",\"name\":\"_dexRouterAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"poolToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"Redeemed\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_tokenSymbol\",\"type\":\"string\"},{\"internalType\":\"address[]\",\"name\":\"_path\",\"type\":\"address[]\"}],\"name\":\"addPath\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"addPoolToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"autoOffsetExactInETH\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountToSwap\",\"type\":\"uint256\"}],\"name\":\"autoOffsetExactInToken\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountToOffset\",\"type\":\"uint256\"}],\"name\":\"autoOffsetExactOutETH\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountToOffset\",\"type\":\"uint256\"}],\"name\":\"autoOffsetExactOutToken\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountToOffset\",\"type\":\"uint256\"}],\"name\":\"autoOffsetPoolToken\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"autoRedeem\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_amounts\",\"type\":\"uint256[]\"}],\"name\":\"autoRetire\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"balances\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fromTokenAmount\",\"type\":\"uint256\"}],\"name\":\"calculateExpectedPoolTokenForETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fromAmount\",\"type\":\"uint256\"}],\"name\":\"calculateExpectedPoolTokenForToken\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAmount\",\"type\":\"uint256\"}],\"name\":\"calculateNeededETHAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAmount\",\"type\":\"uint256\"}],\"name\":\"calculateNeededTokenAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_erc20Addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"dexRouterAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"eligibleSwapPaths\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"eligibleSwapPathsBySymbol\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_erc20Address\",\"type\":\"address\"}],\"name\":\"isERC20AddressEligible\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_path\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"isPoolAddressEligible\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_isEligible\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"paths\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"poolAddresses\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_tokenSymbol\",\"type\":\"string\"}],\"name\":\"removePath\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"removePoolToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"swapExactInETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fromAmount\",\"type\":\"uint256\"}],\"name\":\"swapExactInToken\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAmount\",\"type\":\"uint256\"}],\"name\":\"swapExactOutETH\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAmount\",\"type\":\"uint256\"}],\"name\":\"swapExactOutToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"tokenSymbolsForPaths\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_erc20Addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"events\":{\"Redeemed(address,address,address[],uint256[])\":{\"params\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"poolToken\":\"The address of the Toucan pool token used in the redemption, e.g., NCT\",\"sender\":\"The sender of the transaction\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}}},\"kind\":\"dev\",\"methods\":{\"addPath(string,address[])\":{\"params\":{\"_path\":\"The path of the path to add\",\"_tokenSymbol\":\"The symbol of the token to add\"}},\"addPoolToken(address)\":{\"params\":{\"_poolToken\":\"The address of the pool token to add\"}},\"autoOffsetExactInETH(address)\":{\"details\":\"This function is only available on Polygon, not on Celo.\",\"params\":{\"_poolToken\":\"The address of the pool token to offset, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoOffsetExactInToken(address,address,uint256)\":{\"details\":\"When automatically redeeming pool tokens for the lowest quality TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool token.\",\"params\":{\"_amountToSwap\":\"The amount of ERC20 token to swap into Toucan pool token. Full amount will be used for offsetting.\",\"_fromToken\":\"The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\",\"_poolToken\":\"The address of the pool token to offset, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoOffsetExactOutETH(address,uint256)\":{\"details\":\"If the user sends too much native tokens , the leftover amount will be sent back to the user. This function is only available on Polygon, not on Celo.\",\"params\":{\"_amountToOffset\":\"The amount of TCO2 to offset.\",\"_poolToken\":\"The address of the pool token to offset, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoOffsetExactOutToken(address,address,uint256)\":{\"details\":\"When automatically redeeming pool tokens for the lowest quality TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool token.\",\"params\":{\"_amountToOffset\":\"The amount of TCO2 to offset\",\"_fromToken\":\"The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\",\"_poolToken\":\"The address of the Toucan pool token that the user wants to offset, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoOffsetPoolToken(address,uint256)\":{\"params\":{\"_amountToOffset\":\"The amount of TCO2 to offset.\",\"_poolToken\":\"The address of the pool token to offset, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoRedeem(address,uint256)\":{\"details\":\"Needs to be approved on the client side\",\"params\":{\"_amount\":\"Amount to redeem\",\"_fromToken\":\"Could be the address of NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoRetire(address[],uint256[])\":{\"params\":{\"_amounts\":\"The amounts to retire from each of the corresponding TCO2 addresses\",\"_tco2s\":\"The addresses of the TCO2s to retire\"}},\"calculateExpectedPoolTokenForETH(address,uint256)\":{\"params\":{\"_fromTokenAmount\":\"The amount of native tokens to swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amountOut\":\"The expected amount of Pool token that can be acquired\"}},\"calculateExpectedPoolTokenForToken(address,address,uint256)\":{\"params\":{\"_fromAmount\":\"The amount of ERC20 token to swap\",\"_fromToken\":\"The address of the ERC20 token used for the swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amountOut\":\"The expected amount of Pool token that can be acquired\"}},\"calculateNeededETHAmount(address,uint256)\":{\"params\":{\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\",\"_toAmount\":\"The desired amount of pool token to receive\"},\"returns\":{\"amountIn\":\"The amount of native tokens required in order to swap for the specified amount of the pool token\"}},\"calculateNeededTokenAmount(address,address,uint256)\":{\"params\":{\"_fromToken\":\"The address of the ERC20 token used for the swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\",\"_toAmount\":\"The desired amount of pool token to receive\"},\"returns\":{\"amountIn\":\"The amount of the ERC20 token required in order to swap for the specified amount of the pool token\"}},\"constructor\":{\"details\":\"See `isEligible()` for a list of tokens that can be used in the contract. These can be modified after deployment by the contract owner using `setEligibleTokenAddress()` and `deleteEligibleTokenAddress()`.\",\"params\":{\"_paths\":\"An array of arrays of addresses to describe the path needed to swap form the baseToken to the pool Token to the provided token symbols.\",\"_poolAddresses\":\"A list of pool token addresses.\",\"_tokenSymbolsForPaths\":\"An array of symbols of the token the user want to retire carbon credits for\"}},\"deposit(address,uint256)\":{\"details\":\"Needs to be approved\"},\"isERC20AddressEligible(address)\":{\"params\":{\"_erc20Address\":\"The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\"},\"returns\":{\"_path\":\"Returns the path of the token to be exchanged\"}},\"isPoolAddressEligible(address)\":{\"params\":{\"_poolToken\":\"The address of the pool token to offset, e.g., NCT\"},\"returns\":{\"_isEligible\":\"Returns a bool if the Pool token is eligible for offsetting\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"removePath(string)\":{\"params\":{\"_tokenSymbol\":\"The symbol of the path to remove\"}},\"removePoolToken(address)\":{\"params\":{\"_poolToken\":\"The address of the pool token to remove\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"swapExactInETH(address)\":{\"params\":{\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amountOut\":\"Resulting amount of Toucan pool token that got acquired for the swapped native tokens .\"}},\"swapExactInToken(address,address,uint256)\":{\"details\":\"Needs to be approved on the client side.\",\"params\":{\"_fromAmount\":\"The amount of ERC20 token to swap\",\"_fromToken\":\"The address of the ERC20 token used for the swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amountOut\":\"Resulting amount of Toucan pool token that got acquired for the swapped ERC20 tokens.\"}},\"swapExactOutETH(address,uint256)\":{\"params\":{\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\",\"_toAmount\":\"The required amount of the Toucan pool token (NCT/BCT)\"}},\"swapExactOutToken(address,address,uint256)\":{\"details\":\"Needs to be approved on the client side\",\"params\":{\"_fromToken\":\"The address of the ERC20 token used for the swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\",\"_toAmount\":\"The required amount of the Toucan pool token (NCT/BCT)\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"title\":\"Toucan Protocol Offset Helpers\",\"version\":1},\"userdoc\":{\"events\":{\"Redeemed(address,address,address[],uint256[])\":{\"notice\":\"Emitted upon successful redemption of TCO2 tokens from a Toucan pool token e.g., NCT.\"}},\"kind\":\"user\",\"methods\":{\"addPath(string,address[])\":{\"notice\":\"Change or add eligible paths and their addresses.\"},\"addPoolToken(address)\":{\"notice\":\"Change or add pool token addresses.\"},\"autoOffsetExactInETH(address)\":{\"notice\":\"Retire carbon credits using the lowest quality (oldest) TCO2 tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC. All provided native tokens is consumed for offsetting. The `view` helper function `calculateExpectedPoolTokenForETH()` can be used to calculate the expected amount of TCO2s that will be offset using `autoOffsetExactInETH()`. This function: 1. Swaps the native token e.g. MATIC sent to the contract for the specified pool token. 2. Redeems the pool token for the poorest quality TCO2 tokens available. 3. Retires the TCO2 tokens.\"},\"autoOffsetExactInToken(address,address,uint256)\":{\"notice\":\"Retire carbon credits using the lowest quality (oldest) TCO2 tokens available from the specified Toucan token pool by sending ERC20 tokens (cUSD, USDC, WETH, WMATIC). All provided token is consumed for offsetting. The `view` helper function `calculateExpectedPoolTokenForToken()` can be used to calculate the expected amount of TCO2s that will be offset using `autoOffsetExactInToken()`. This function: 1. Swaps the ERC20 token sent to the contract for the specified pool token. 2. Redeems the pool token for the poorest quality TCO2 tokens available. 3. Retires the TCO2 tokens. Note: The client must approve the ERC20 token that is sent to the contract.\"},\"autoOffsetExactOutETH(address,uint256)\":{\"notice\":\"Retire carbon credits using the lowest quality (oldest) TCO2 tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC. The `view` helper function `calculateNeededETHAmount()` should be called before using `autoOffsetExactOutETH()`, to determine how much native tokens e.g., MATIC must be sent to the `OffsetHelper` contract in order to retire the specified amount of carbon. This function: 1. Swaps the native token e.g. MATIC sent to the contract for the specified pool token. 2. Redeems the pool token for the poorest quality TCO2 tokens available. 3. Retires the TCO2 tokens.\"},\"autoOffsetExactOutToken(address,address,uint256)\":{\"notice\":\"Retire carbon credits using the lowest quality (oldest) TCO2 tokens available from the specified Toucan token pool by sending ERC20 tokens (cUSD, USDC, WETH, WMATIC). The `view` helper function `calculateNeededTokenAmount()` should be called before using `autoOffsetExactOutToken()`, to determine how much native tokens e.g., MATIC must be sent to the `OffsetHelper` contract in order to retire the specified amount of carbon. This function: 1. Swaps the ERC20 token sent to the contract for the specified pool token. 2. Redeems the pool token for the poorest quality TCO2 tokens available. 3. Retires the TCO2 tokens. Note: The client must approve the ERC20 token that is sent to the contract.\"},\"autoOffsetPoolToken(address,uint256)\":{\"notice\":\"Retire carbon credits using the lowest quality (oldest) TCO2 tokens available by sending Toucan pool tokens, e.g., NCT. This function: 1. Redeems the pool token for the poorest quality TCO2 tokens available. 2. Retires the TCO2 tokens. Note: The client must approve the pool token that is sent.\"},\"autoRedeem(address,uint256)\":{\"notice\":\"Redeems the specified amount of NCT / BCT for TCO2.\"},\"autoRetire(address[],uint256[])\":{\"notice\":\"Retire the specified TCO2 tokens.\"},\"calculateExpectedPoolTokenForETH(address,uint256)\":{\"notice\":\"Calculates the expected amount of Toucan Pool token that can be acquired by swapping the provided amount of native tokens e.g., MATIC.\"},\"calculateExpectedPoolTokenForToken(address,address,uint256)\":{\"notice\":\"Calculates the expected amount of Toucan Pool token that can be acquired by swapping the provided amount of ERC20 token.\"},\"calculateNeededETHAmount(address,uint256)\":{\"notice\":\"Return how much native tokens e.g, MATIC is required in order to swap for the desired amount of a Toucan pool token, e.g., NCT.\"},\"calculateNeededTokenAmount(address,address,uint256)\":{\"notice\":\"Return how much of the specified ERC20 token is required in order to swap for the desired amount of a Toucan pool token, for example, e.g., NCT.\"},\"constructor\":{\"notice\":\"Contract constructor. Should specify arrays of ERC20 symbols and addresses that can used by the contract.\"},\"deposit(address,uint256)\":{\"notice\":\"Allow users to deposit BCT / NCT.\"},\"isERC20AddressEligible(address)\":{\"notice\":\"Checks if ERC20 Token is eligible for swapping.\"},\"isPoolAddressEligible(address)\":{\"notice\":\"Checks if Pool Address is eligible for offsetting.\"},\"removePath(string)\":{\"notice\":\"Delete eligible tokens stored in the contract.\"},\"removePoolToken(address)\":{\"notice\":\"Delete eligible pool token addresses stored in the contract.\"},\"swapExactInETH(address)\":{\"notice\":\"Swap native tokens e.g., MATIC for Toucan pool tokens (BCT/NCT) on SushiSwap. All provided native tokens will be swapped.\"},\"swapExactInToken(address,address,uint256)\":{\"notice\":\"Swap eligible ERC20 tokens for Toucan pool tokens (BCT/NCT) on SushiSwap. All provided ERC20 tokens will be swapped.\"},\"swapExactOutETH(address,uint256)\":{\"notice\":\"Swap native tokens e.g., MATIC for Toucan pool tokens (BCT/NCT) on SushiSwap. Remaining native tokens that was not consumed by the swap is returned.\"},\"swapExactOutToken(address,address,uint256)\":{\"notice\":\"Swap eligible ERC20 tokens for Toucan pool tokens (BCT/NCT) on SushiSwap\"},\"withdraw(address,uint256)\":{\"notice\":\"Allow users to withdraw tokens they have deposited.\"}},\"notice\":\"Helper functions that simplify the carbon offsetting (retirement) process. Retiring carbon tokens requires multiple steps and interactions with Toucan Protocol's main contracts: 1. Obtain a Toucan pool token e.g., NCT (by performing a token swap on a DEX). 2. Redeem the pool token for a TCO2 token. 3. Retire the TCO2 token. These steps are combined in each of the following \\\"auto offset\\\" methods implemented in `OffsetHelper` to allow a retirement within one transaction: - `autoOffsetPoolToken()` if the user already owns a Toucan pool token e.g., NCT, - `autoOffsetExactOutETH()` if the user would like to perform a retirement using native tokens e.g., MATIC, specifying the exact amount of TCO2s to retire (only on Polygon, not on Celo), - `autoOffsetExactInETH()` if the user would like to perform a retirement using native tokens, swapping all sent native tokens into TCO2s (only on Polygon, not on Celo), - `autoOffsetExactOutToken()` if the user would like to perform a retirement using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount of TCO2s to retire, - `autoOffsetExactInToken()` if the user would like to perform a retirement using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount of token to swap into TCO2s. In these methods, \\\"auto\\\" refers to the fact that these methods use `autoRedeem()` in order to automatically choose a TCO2 token corresponding to the oldest tokenized carbon project in the specfified token pool. There are no fees incurred by the user when using `autoRedeem()`, i.e., the user receives 1 TCO2 token for each pool token (BCT/NCT) redeemed. There are two `view` helper functions `calculateNeededETHAmount()` and `calculateNeededTokenAmount()` that should be called before using `autoOffsetExactOutETH()` and `autoOffsetExactOutToken()`, to determine how much native tokens e.g., MATIC, respectively how much of the ERC20 token must be sent to the `OffsetHelper` contract in order to retire the specified amount of carbon. The two `view` helper functions `calculateExpectedPoolTokenForETH()` and `calculateExpectedPoolTokenForToken()` can be used to calculate the expected amount of TCO2s that will be offset using functions `autoOffsetExactInETH()` and `autoOffsetExactInToken()`.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/OffsetHelper.sol\":\"OffsetHelper\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x247c62047745915c0af6b955470a72d1696ebad4352d7d3011aef1a2463cd888\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0xe798cadb41e2da274913e4b3183a80f50fb057a42238fe8467e077268100ec27\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20Upgradeable {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x4e733d3164f73f461eaf9d8087a7ad1ea180bdc8ba0d3d61b0e1ae16d8e63dff\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2edcb41c121abc510932e8d83ff8b82cf9cdde35e7c297622f5c29ef0af25183\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n function safePermit(\\n IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9b72f93be69ca894d8492c244259615c4a742afc8d63720dbc8bb81087d9b238\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721Receiver {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol\":{\"content\":\"pragma solidity >=0.6.2;\\n\\ninterface IUniswapV2Router01 {\\n function factory() external pure returns (address);\\n function WETH() external pure returns (address);\\n\\n function addLiquidity(\\n address tokenA,\\n address tokenB,\\n uint amountADesired,\\n uint amountBDesired,\\n uint amountAMin,\\n uint amountBMin,\\n address to,\\n uint deadline\\n ) external returns (uint amountA, uint amountB, uint liquidity);\\n function addLiquidityETH(\\n address token,\\n uint amountTokenDesired,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline\\n ) external payable returns (uint amountToken, uint amountETH, uint liquidity);\\n function removeLiquidity(\\n address tokenA,\\n address tokenB,\\n uint liquidity,\\n uint amountAMin,\\n uint amountBMin,\\n address to,\\n uint deadline\\n ) external returns (uint amountA, uint amountB);\\n function removeLiquidityETH(\\n address token,\\n uint liquidity,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline\\n ) external returns (uint amountToken, uint amountETH);\\n function removeLiquidityWithPermit(\\n address tokenA,\\n address tokenB,\\n uint liquidity,\\n uint amountAMin,\\n uint amountBMin,\\n address to,\\n uint deadline,\\n bool approveMax, uint8 v, bytes32 r, bytes32 s\\n ) external returns (uint amountA, uint amountB);\\n function removeLiquidityETHWithPermit(\\n address token,\\n uint liquidity,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline,\\n bool approveMax, uint8 v, bytes32 r, bytes32 s\\n ) external returns (uint amountToken, uint amountETH);\\n function swapExactTokensForTokens(\\n uint amountIn,\\n uint amountOutMin,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external returns (uint[] memory amounts);\\n function swapTokensForExactTokens(\\n uint amountOut,\\n uint amountInMax,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external returns (uint[] memory amounts);\\n function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)\\n external\\n payable\\n returns (uint[] memory amounts);\\n function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)\\n external\\n returns (uint[] memory amounts);\\n function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)\\n external\\n returns (uint[] memory amounts);\\n function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)\\n external\\n payable\\n returns (uint[] memory amounts);\\n\\n function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);\\n function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);\\n function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);\\n function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);\\n function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);\\n}\\n\",\"keccak256\":\"0x8a3c5c449d4b7cd76513ed6995f4b86e4a86f222c770f8442f5fc128ce29b4d2\"},\"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\":{\"content\":\"pragma solidity >=0.6.2;\\n\\nimport './IUniswapV2Router01.sol';\\n\\ninterface IUniswapV2Router02 is IUniswapV2Router01 {\\n function removeLiquidityETHSupportingFeeOnTransferTokens(\\n address token,\\n uint liquidity,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline\\n ) external returns (uint amountETH);\\n function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(\\n address token,\\n uint liquidity,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline,\\n bool approveMax, uint8 v, bytes32 r, bytes32 s\\n ) external returns (uint amountETH);\\n\\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\\n uint amountIn,\\n uint amountOutMin,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external;\\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\\n uint amountOutMin,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external payable;\\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\\n uint amountIn,\\n uint amountOutMin,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external;\\n}\\n\",\"keccak256\":\"0x744e30c133bd0f7ca9e7163433cf6d72f45c6bb1508c2c9c02f1a6db796ae59d\"},\"contracts/OffsetHelper.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2022 Toucan Labs\\n// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\\\";\\nimport \\\"./OffsetHelperStorage.sol\\\";\\nimport \\\"./interfaces/IToucanPoolToken.sol\\\";\\nimport \\\"./interfaces/IToucanCarbonOffsets.sol\\\";\\nimport \\\"./interfaces/IToucanContractRegistry.sol\\\";\\n\\n/**\\n * @title Toucan Protocol Offset Helpers\\n * @notice Helper functions that simplify the carbon offsetting (retirement)\\n * process.\\n *\\n * Retiring carbon tokens requires multiple steps and interactions with\\n * Toucan Protocol's main contracts:\\n * 1. Obtain a Toucan pool token e.g., NCT (by performing a token\\n * swap on a DEX).\\n * 2. Redeem the pool token for a TCO2 token.\\n * 3. Retire the TCO2 token.\\n *\\n * These steps are combined in each of the following \\\"auto offset\\\" methods\\n * implemented in `OffsetHelper` to allow a retirement within one transaction:\\n * - `autoOffsetPoolToken()` if the user already owns a Toucan pool\\n * token e.g., NCT,\\n * - `autoOffsetExactOutETH()` if the user would like to perform a retirement\\n * using native tokens e.g., MATIC, specifying the exact amount of TCO2s to retire (only on Polygon, not on Celo),\\n * - `autoOffsetExactInETH()` if the user would like to perform a retirement\\n * using native tokens, swapping all sent native tokens into TCO2s (only on Polygon, not on Celo),\\n * - `autoOffsetExactOutToken()` if the user would like to perform a retirement\\n * using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount\\n * of TCO2s to retire,\\n * - `autoOffsetExactInToken()` if the user would like to perform a retirement\\n * using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount\\n * of token to swap into TCO2s.\\n *\\n * In these methods, \\\"auto\\\" refers to the fact that these methods use\\n * `autoRedeem()` in order to automatically choose a TCO2 token corresponding\\n * to the oldest tokenized carbon project in the specfified token pool.\\n * There are no fees incurred by the user when using `autoRedeem()`, i.e., the\\n * user receives 1 TCO2 token for each pool token (BCT/NCT) redeemed.\\n *\\n * There are two `view` helper functions `calculateNeededETHAmount()` and\\n * `calculateNeededTokenAmount()` that should be called before using\\n * `autoOffsetExactOutETH()` and `autoOffsetExactOutToken()`, to determine how\\n * much native tokens e.g., MATIC, respectively how much of the ERC20 token must be sent to the\\n * `OffsetHelper` contract in order to retire the specified amount of carbon.\\n *\\n * The two `view` helper functions `calculateExpectedPoolTokenForETH()` and\\n * `calculateExpectedPoolTokenForToken()` can be used to calculate the\\n * expected amount of TCO2s that will be offset using functions\\n * `autoOffsetExactInETH()` and `autoOffsetExactInToken()`.\\n */\\ncontract OffsetHelper is OffsetHelperStorage {\\n using SafeERC20 for IERC20;\\n // Chain ID of Celo mainnet\\n uint256 private constant CELO_MAINNET_CHAINID = 42220;\\n\\n /**\\n * @notice Emitted upon successful redemption of TCO2 tokens from a Toucan\\n * pool token e.g., NCT.\\n *\\n * @param sender The sender of the transaction\\n * @param poolToken The address of the Toucan pool token used in the\\n * redemption, e.g., NCT\\n * @param tco2s An array of the TCO2 addresses that were redeemed\\n * @param amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n event Redeemed(\\n address sender,\\n address poolToken,\\n address[] tco2s,\\n uint256[] amounts\\n );\\n\\n modifier onlyRedeemable(address _token) {\\n require(isRedeemable(_token), \\\"Token not redeemable\\\");\\n\\n _;\\n }\\n\\n modifier onlySwappable(address _token) {\\n require(isSwappable(_token), \\\"Path doesn't yet exists.\\\");\\n\\n _;\\n }\\n\\n modifier nativeTokenChain() {\\n require(\\n block.chainid != CELO_MAINNET_CHAINID,\\n \\\"The function is not available on this network.\\\"\\n );\\n\\n _;\\n }\\n\\n /**\\n * @notice Contract constructor. Should specify arrays of ERC20 symbols and\\n * addresses that can used by the contract.\\n *\\n * @dev See `isEligible()` for a list of tokens that can be used in the\\n * contract. These can be modified after deployment by the contract owner\\n * using `setEligibleTokenAddress()` and `deleteEligibleTokenAddress()`.\\n *\\n * @param _poolAddresses A list of pool token addresses.\\n * @param _tokenSymbolsForPaths An array of symbols of the token the user want to retire carbon credits for\\n * @param _paths An array of arrays of addresses to describe the path needed to swap form the baseToken to the pool Token\\n * to the provided token symbols.\\n */\\n constructor(\\n address[] memory _poolAddresses,\\n string[] memory _tokenSymbolsForPaths,\\n address[][] memory _paths,\\n address _dexRouterAddress\\n ) {\\n dexRouterAddress = _dexRouterAddress;\\n poolAddresses = _poolAddresses;\\n tokenSymbolsForPaths = _tokenSymbolsForPaths;\\n paths = _paths;\\n\\n uint256 i = 0;\\n uint256 eligibleSwapPathsBySymbolLen = _tokenSymbolsForPaths.length;\\n while (i < eligibleSwapPathsBySymbolLen) {\\n eligibleSwapPaths[_paths[i][0]] = _paths[i];\\n eligibleSwapPathsBySymbol[_tokenSymbolsForPaths[i]] = _paths[i];\\n i += 1;\\n }\\n }\\n\\n // fallback payable and receive method to fix the situation where transfering dust native tokens\\n // in the native tokens to token swap fails\\n\\n receive() external payable {}\\n\\n fallback() external payable {}\\n\\n // ----------------------------------------\\n // Upgradable related functions\\n // ----------------------------------------\\n\\n function initialize() external virtual initializer {\\n __Ownable_init_unchained();\\n }\\n\\n // ----------------------------------------\\n // Public functions\\n // ----------------------------------------\\n\\n /**\\n * @notice Retire carbon credits using the lowest quality (oldest) TCO2\\n * tokens available from the specified Toucan token pool by sending ERC20\\n * tokens (cUSD, USDC, WETH, WMATIC). The `view` helper function\\n * `calculateNeededTokenAmount()` should be called before using `autoOffsetExactOutToken()`,\\n * to determine how much native tokens e.g., MATIC must be sent to the\\n * `OffsetHelper` contract in order to retire the specified amount of carbon.\\n *\\n * This function:\\n * 1. Swaps the ERC20 token sent to the contract for the specified pool token.\\n * 2. Redeems the pool token for the poorest quality TCO2 tokens available.\\n * 3. Retires the TCO2 tokens.\\n *\\n * Note: The client must approve the ERC20 token that is sent to the contract.\\n *\\n * @dev When automatically redeeming pool tokens for the lowest quality\\n * TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool\\n * token.\\n *\\n * @param _fromToken The address of the ERC20 token that the user sends\\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\\n * @param _poolToken The address of the Toucan pool token that the\\n * user wants to offset, e.g., NCT\\n * @param _amountToOffset The amount of TCO2 to offset\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetExactOutToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _amountToOffset\\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\\n // swap input token for BCT / NCT\\n swapExactOutToken(_fromToken, _poolToken, _amountToOffset);\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire carbon credits using the lowest quality (oldest) TCO2\\n * tokens available from the specified Toucan token pool by sending ERC20\\n * tokens (cUSD, USDC, WETH, WMATIC). All provided token is consumed for\\n * offsetting.\\n *\\n * The `view` helper function `calculateExpectedPoolTokenForToken()`\\n * can be used to calculate the expected amount of TCO2s that will be\\n * offset using `autoOffsetExactInToken()`.\\n *\\n * This function:\\n * 1. Swaps the ERC20 token sent to the contract for the specified pool token.\\n * 2. Redeems the pool token for the poorest quality TCO2 tokens available.\\n * 3. Retires the TCO2 tokens.\\n *\\n * Note: The client must approve the ERC20 token that is sent to the contract.\\n *\\n * @dev When automatically redeeming pool tokens for the lowest quality\\n * TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool\\n * token.\\n *\\n * @param _fromToken The address of the ERC20 token that the user sends\\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\\n * @param _poolToken The address of the pool token to offset,\\n * e.g., NCT\\n * @param _amountToSwap The amount of ERC20 token to swap into Toucan pool\\n * token. Full amount will be used for offsetting.\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetExactInToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _amountToSwap\\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\\n // swap input token for BCT / NCT\\n uint256 amountToOffset = swapExactInToken(\\n _fromToken,\\n _poolToken,\\n _amountToSwap\\n );\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire carbon credits using the lowest quality (oldest) TCO2\\n * tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC.\\n *\\n * The `view` helper function `calculateNeededETHAmount()` should be called before using\\n * `autoOffsetExactOutETH()`, to determine how much native tokens e.g.,\\n * MATIC must be sent to the `OffsetHelper` contract in order to retire\\n * the specified amount of carbon.\\n *\\n * This function:\\n * 1. Swaps the native token e.g. MATIC sent to the contract for the specified pool token.\\n * 2. Redeems the pool token for the poorest quality TCO2 tokens available.\\n * 3. Retires the TCO2 tokens.\\n *\\n * @dev If the user sends too much native tokens , the leftover amount will be sent back\\n * to the user. This function is only available on Polygon, not on Celo.\\n *\\n * @param _poolToken The address of the pool token to offset,\\n * e.g., NCT\\n * @param _amountToOffset The amount of TCO2 to offset.\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetExactOutETH(\\n address _poolToken,\\n uint256 _amountToOffset\\n )\\n public\\n payable\\n nativeTokenChain\\n returns (address[] memory tco2s, uint256[] memory amounts)\\n {\\n // swap native tokens for BCT / NCT\\n swapExactOutETH(_poolToken, _amountToOffset);\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire carbon credits using the lowest quality (oldest) TCO2\\n * tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC.\\n * All provided native tokens is consumed for offsetting.\\n *\\n * The `view` helper function `calculateExpectedPoolTokenForETH()` can be\\n * used to calculate the expected amount of TCO2s that will be offset\\n * using `autoOffsetExactInETH()`.\\n *\\n * This function:\\n * 1. Swaps the native token e.g. MATIC sent to the contract for the specified pool token.\\n * 2. Redeems the pool token for the poorest quality TCO2 tokens available.\\n * 3. Retires the TCO2 tokens.\\n *\\n * @dev This function is only available on Polygon, not on Celo.\\n *\\n * @param _poolToken The address of the pool token to offset,\\n * e.g., NCT\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetExactInETH(\\n address _poolToken\\n )\\n public\\n payable\\n nativeTokenChain\\n returns (address[] memory tco2s, uint256[] memory amounts)\\n {\\n // swap native tokens for BCT / NCT\\n uint256 amountToOffset = swapExactInETH(_poolToken);\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire carbon credits using the lowest quality (oldest) TCO2\\n * tokens available by sending Toucan pool tokens, e.g., NCT.\\n *\\n * This function:\\n * 1. Redeems the pool token for the poorest quality TCO2 tokens available.\\n * 2. Retires the TCO2 tokens.\\n *\\n * Note: The client must approve the pool token that is sent.\\n *\\n * @param _poolToken The address of the pool token to offset,\\n * e.g., NCT\\n * @param _amountToOffset The amount of TCO2 to offset.\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetPoolToken(\\n address _poolToken,\\n uint256 _amountToOffset\\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\\n // deposit pool token from user to this contract\\n deposit(_poolToken, _amountToOffset);\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Swap eligible ERC20 tokens for Toucan pool tokens (BCT/NCT) on SushiSwap\\n * @dev Needs to be approved on the client side\\n * @param _fromToken The address of the ERC20 token used for the swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _toAmount The required amount of the Toucan pool token (NCT/BCT)\\n */\\n function swapExactOutToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _toAmount\\n ) public onlySwappable(_fromToken) onlyRedeemable(_poolToken) {\\n // calculate path & amounts\\n (\\n address[] memory path,\\n uint256[] memory expAmounts\\n ) = calculateExactOutSwap(_fromToken, _poolToken, _toAmount);\\n uint256 amountIn = expAmounts[0];\\n\\n // transfer tokens\\n IERC20(_fromToken).safeTransferFrom(\\n msg.sender,\\n address(this),\\n amountIn\\n );\\n\\n // approve router\\n IERC20(_fromToken).approve(dexRouterAddress, amountIn);\\n\\n // swap\\n uint256[] memory amounts = dexRouter().swapTokensForExactTokens(\\n _toAmount,\\n amountIn, // max. input amount\\n path,\\n address(this),\\n block.timestamp\\n );\\n\\n // remove remaining approval if less input token was consumed\\n if (amounts[0] < amountIn) {\\n IERC20(_fromToken).approve(dexRouterAddress, 0);\\n }\\n\\n // update balances\\n balances[msg.sender][_poolToken] += _toAmount;\\n }\\n\\n /**\\n * @notice Swap eligible ERC20 tokens for Toucan pool tokens (BCT/NCT) on\\n * SushiSwap. All provided ERC20 tokens will be swapped.\\n * @dev Needs to be approved on the client side.\\n * @param _fromToken The address of the ERC20 token used for the swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _fromAmount The amount of ERC20 token to swap\\n * @return amountOut Resulting amount of Toucan pool token that got acquired for the\\n * swapped ERC20 tokens.\\n */\\n function swapExactInToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _fromAmount\\n )\\n public\\n onlySwappable(_fromToken)\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountOut)\\n {\\n // calculate path & amounts\\n\\n address[] memory path = generatePath(_fromToken, _poolToken);\\n\\n uint256 len = path.length;\\n\\n // transfer tokens\\n IERC20(_fromToken).safeTransferFrom(\\n msg.sender,\\n address(this),\\n _fromAmount\\n );\\n\\n // approve router\\n IERC20(_fromToken).safeApprove(dexRouterAddress, _fromAmount);\\n\\n // swap\\n uint256[] memory amounts = dexRouter().swapExactTokensForTokens(\\n _fromAmount,\\n 0, // min. output amount\\n path,\\n address(this),\\n block.timestamp\\n );\\n amountOut = amounts[len - 1];\\n\\n // update balances\\n balances[msg.sender][_poolToken] += amountOut;\\n }\\n\\n /**\\n * @notice Swap native tokens e.g., MATIC for Toucan pool tokens (BCT/NCT) on SushiSwap.\\n * Remaining native tokens that was not consumed by the swap is returned.\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _toAmount The required amount of the Toucan pool token (NCT/BCT)\\n */\\n function swapExactOutETH(\\n address _poolToken,\\n uint256 _toAmount\\n ) public payable nativeTokenChain onlyRedeemable(_poolToken) {\\n // create path & amounts\\n // wrap the native token\\n address fromToken = eligibleSwapPathsBySymbol[\\\"WMATIC\\\"][0];\\n address[] memory path = generatePath(fromToken, _poolToken);\\n\\n // swap\\n uint256[] memory amounts = dexRouter().swapETHForExactTokens{\\n value: msg.value\\n }(_toAmount, path, address(this), block.timestamp);\\n\\n // send surplus back\\n if (msg.value > amounts[0]) {\\n uint256 leftoverETH = msg.value - amounts[0];\\n (bool success, ) = msg.sender.call{value: leftoverETH}(\\n new bytes(0)\\n );\\n\\n require(success, \\\"Failed to send surplus back\\\");\\n }\\n\\n // update balances\\n balances[msg.sender][_poolToken] += _toAmount;\\n }\\n\\n /**\\n * @notice Swap native tokens e.g., MATIC for Toucan pool tokens (BCT/NCT) on SushiSwap. All\\n * provided native tokens will be swapped.\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @return amountOut Resulting amount of Toucan pool token that got acquired for the\\n * swapped native tokens .\\n */\\n function swapExactInETH(\\n address _poolToken\\n )\\n public\\n payable\\n nativeTokenChain\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountOut)\\n {\\n // create path & amounts\\n uint256 fromAmount = msg.value;\\n // wrap the native token\\n address fromToken = eligibleSwapPathsBySymbol[\\\"WMATIC\\\"][0];\\n address[] memory path = generatePath(fromToken, _poolToken);\\n\\n uint256 len = path.length;\\n\\n // swap\\n uint256[] memory amounts = dexRouter().swapExactETHForTokens{\\n value: fromAmount\\n }(0, path, address(this), block.timestamp);\\n amountOut = amounts[len - 1];\\n\\n // update balances\\n balances[msg.sender][_poolToken] += amountOut;\\n }\\n\\n /**\\n * @notice Allow users to withdraw tokens they have deposited.\\n */\\n function withdraw(address _erc20Addr, uint256 _amount) public {\\n require(\\n balances[msg.sender][_erc20Addr] >= _amount,\\n \\\"Insufficient balance\\\"\\n );\\n\\n IERC20(_erc20Addr).safeTransfer(msg.sender, _amount);\\n balances[msg.sender][_erc20Addr] -= _amount;\\n }\\n\\n /**\\n * @notice Allow users to deposit BCT / NCT.\\n * @dev Needs to be approved\\n */\\n function deposit(\\n address _erc20Addr,\\n uint256 _amount\\n ) public onlyRedeemable(_erc20Addr) {\\n IERC20(_erc20Addr).safeTransferFrom(msg.sender, address(this), _amount);\\n balances[msg.sender][_erc20Addr] += _amount;\\n }\\n\\n /**\\n * @notice Redeems the specified amount of NCT / BCT for TCO2.\\n * @dev Needs to be approved on the client side\\n * @param _fromToken Could be the address of NCT\\n * @param _amount Amount to redeem\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoRedeem(\\n address _fromToken,\\n uint256 _amount\\n )\\n public\\n onlyRedeemable(_fromToken)\\n returns (address[] memory tco2s, uint256[] memory amounts)\\n {\\n require(\\n balances[msg.sender][_fromToken] >= _amount,\\n \\\"Insufficient NCT/BCT balance\\\"\\n );\\n\\n // instantiate pool token (NCT)\\n IToucanPoolToken PoolTokenImplementation = IToucanPoolToken(_fromToken);\\n\\n // auto redeem pool token for TCO2; will transfer automatically picked TCO2 to this contract\\n (tco2s, amounts) = PoolTokenImplementation.redeemAuto2(_amount);\\n\\n // update balances\\n balances[msg.sender][_fromToken] -= _amount;\\n uint256 tco2sLen = tco2s.length;\\n for (uint256 index = 0; index < tco2sLen; index++) {\\n balances[msg.sender][tco2s[index]] += amounts[index];\\n }\\n\\n emit Redeemed(msg.sender, _fromToken, tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire the specified TCO2 tokens.\\n * @param _tco2s The addresses of the TCO2s to retire\\n * @param _amounts The amounts to retire from each of the corresponding\\n * TCO2 addresses\\n */\\n function autoRetire(\\n address[] memory _tco2s,\\n uint256[] memory _amounts\\n ) public {\\n uint256 tco2sLen = _tco2s.length;\\n require(tco2sLen != 0, \\\"Array empty\\\");\\n\\n require(tco2sLen == _amounts.length, \\\"Arrays unequal\\\");\\n\\n uint256 i = 0;\\n while (i < tco2sLen) {\\n if (_amounts[i] == 0) {\\n unchecked {\\n i++;\\n }\\n continue;\\n }\\n require(\\n balances[msg.sender][_tco2s[i]] >= _amounts[i],\\n \\\"Insufficient TCO2 balance\\\"\\n );\\n\\n balances[msg.sender][_tco2s[i]] -= _amounts[i];\\n\\n IToucanCarbonOffsets(_tco2s[i]).retire(_amounts[i]);\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n // ----------------------------------------\\n // Public view functions\\n // ----------------------------------------\\n\\n /**\\n * @notice Return how much of the specified ERC20 token is required in\\n * order to swap for the desired amount of a Toucan pool token, for\\n * example, e.g., NCT.\\n *\\n * @param _fromToken The address of the ERC20 token used for the swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _toAmount The desired amount of pool token to receive\\n * @return amountIn The amount of the ERC20 token required in order to\\n * swap for the specified amount of the pool token\\n */\\n function calculateNeededTokenAmount(\\n address _fromToken,\\n address _poolToken,\\n uint256 _toAmount\\n )\\n public\\n view\\n onlySwappable(_fromToken)\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountIn)\\n {\\n (, uint256[] memory amounts) = calculateExactOutSwap(\\n _fromToken,\\n _poolToken,\\n _toAmount\\n );\\n amountIn = amounts[0];\\n }\\n\\n /**\\n * @notice Calculates the expected amount of Toucan Pool token that can be\\n * acquired by swapping the provided amount of ERC20 token.\\n *\\n * @param _fromToken The address of the ERC20 token used for the swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _fromAmount The amount of ERC20 token to swap\\n * @return amountOut The expected amount of Pool token that can be acquired\\n */\\n function calculateExpectedPoolTokenForToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _fromAmount\\n )\\n public\\n view\\n onlySwappable(_fromToken)\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountOut)\\n {\\n (, uint256[] memory amounts) = calculateExactInSwap(\\n _fromToken,\\n _poolToken,\\n _fromAmount\\n );\\n amountOut = amounts[amounts.length - 1];\\n }\\n\\n /**\\n * @notice Return how much native tokens e.g, MATIC is required in order to swap for the\\n * desired amount of a Toucan pool token, e.g., NCT.\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _toAmount The desired amount of pool token to receive\\n * @return amountIn The amount of native tokens required in order to swap for\\n * the specified amount of the pool token\\n */\\n function calculateNeededETHAmount(\\n address _poolToken,\\n uint256 _toAmount\\n )\\n public\\n view\\n nativeTokenChain\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountIn)\\n {\\n address fromToken = eligibleSwapPathsBySymbol[\\\"WMATIC\\\"][0];\\n (, uint256[] memory amounts) = calculateExactOutSwap(\\n fromToken,\\n _poolToken,\\n _toAmount\\n );\\n amountIn = amounts[0];\\n }\\n\\n /**\\n * @notice Calculates the expected amount of Toucan Pool token that can be\\n * acquired by swapping the provided amount of native tokens e.g., MATIC.\\n *\\n * @param _fromTokenAmount The amount of native tokens to swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @return amountOut The expected amount of Pool token that can be acquired\\n */\\n function calculateExpectedPoolTokenForETH(\\n address _poolToken,\\n uint256 _fromTokenAmount\\n )\\n public\\n view\\n nativeTokenChain\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountOut)\\n {\\n address fromToken = eligibleSwapPathsBySymbol[\\\"WMATIC\\\"][0];\\n (, uint256[] memory amounts) = calculateExactInSwap(\\n fromToken,\\n _poolToken,\\n _fromTokenAmount\\n );\\n amountOut = amounts[amounts.length - 1];\\n }\\n\\n /**\\n * @notice Checks if Pool Address is eligible for offsetting.\\n * @param _poolToken The address of the pool token to offset,\\n * e.g., NCT\\n * @return _isEligible Returns a bool if the Pool token is eligible for offsetting\\n */\\n function isPoolAddressEligible(\\n address _poolToken\\n ) public view returns (bool _isEligible) {\\n _isEligible = isRedeemable(_poolToken);\\n }\\n\\n /**\\n * @notice Checks if ERC20 Token is eligible for swapping.\\n * @param _erc20Address The address of the ERC20 token that the user sends\\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\\n * @return _path Returns the path of the token to be exchanged\\n */\\n function isERC20AddressEligible(\\n address _erc20Address\\n ) public view returns (address[] memory _path) {\\n _path = eligibleSwapPaths[_erc20Address];\\n }\\n\\n // ----------------------------------------\\n // Internal methods\\n // ----------------------------------------\\n\\n function calculateExactOutSwap(\\n address _fromToken,\\n address _poolToken,\\n uint256 _toAmount\\n ) internal view returns (address[] memory path, uint256[] memory amounts) {\\n // create path & calculate amounts\\n path = generatePath(_fromToken, _poolToken);\\n uint256 len = path.length;\\n\\n amounts = dexRouter().getAmountsIn(_toAmount, path);\\n\\n // sanity check arrays\\n require(len == amounts.length, \\\"Arrays unequal\\\");\\n require(_toAmount == amounts[len - 1], \\\"Output amount mismatch\\\");\\n }\\n\\n function calculateExactInSwap(\\n address _fromToken,\\n address _poolToken,\\n uint256 _fromAmount\\n ) internal view returns (address[] memory path, uint256[] memory amounts) {\\n // create path & calculate amounts\\n path = generatePath(_fromToken, _poolToken);\\n uint256 len = path.length;\\n\\n amounts = dexRouter().getAmountsOut(_fromAmount, path);\\n\\n // sanity check arrays\\n require(len == amounts.length, \\\"Arrays unequal\\\");\\n require(_fromAmount == amounts[0], \\\"Input amount mismatch\\\");\\n }\\n\\n /**\\n * @notice Show all pool token addresses that can be used to retired.\\n * @param _fromToken a list of token symbols that can be retired.\\n * @param _toToken a list of token symbols that can be retired.\\n */\\n function generatePath(\\n address _fromToken,\\n address _toToken\\n ) internal view returns (address[] memory path) {\\n uint256 len = eligibleSwapPaths[_fromToken].length;\\n if (len == 1) {\\n path = new address[](2);\\n path[0] = _fromToken;\\n path[1] = _toToken;\\n return path;\\n }\\n if (len == 2) {\\n path = new address[](3);\\n path[0] = _fromToken;\\n path[1] = eligibleSwapPaths[_fromToken][1];\\n path[2] = _toToken;\\n return path;\\n }\\n if (len == 3) {\\n path = new address[](3);\\n path[0] = _fromToken;\\n path[1] = eligibleSwapPaths[_fromToken][1];\\n path[2] = eligibleSwapPaths[_fromToken][2];\\n path[3] = _toToken;\\n return path;\\n } else {\\n path = new address[](4);\\n path[0] = _fromToken;\\n path[1] = eligibleSwapPaths[_fromToken][1];\\n path[2] = eligibleSwapPaths[_fromToken][2];\\n path[3] = eligibleSwapPaths[_fromToken][3];\\n path[4] = _toToken;\\n return path;\\n }\\n }\\n\\n function dexRouter() internal view returns (IUniswapV2Router02) {\\n return IUniswapV2Router02(dexRouterAddress);\\n }\\n\\n /**\\n * @notice Checks whether an address is a Toucan pool token address\\n * @param _erc20Address address of token to be checked\\n * @return True if the address is a Toucan pool token address\\n */\\n function isRedeemable(address _erc20Address) private view returns (bool) {\\n for (uint i = 0; i < poolAddresses.length; i++) {\\n if (poolAddresses[i] == _erc20Address) {\\n return true;\\n }\\n }\\n\\n return false;\\n }\\n\\n /**\\n * @notice Checks whether an address can be used in a token swap\\n * @param _erc20Address address of token to be checked\\n * @return True if the specified address can be used in a swap\\n */\\n function isSwappable(address _erc20Address) private view returns (bool) {\\n for (uint i = 0; i < paths.length; i++) {\\n if (paths[i][0] == _erc20Address) {\\n return true;\\n }\\n }\\n\\n return false;\\n }\\n\\n /**\\n * @notice Cheks if Pool Token is eligible for Offsetting.\\n * @param _poolToken The addresses of the pool token to redeem\\n * @return _isEligible Returns if token can be redeemed\\n */\\n\\n // ----------------------------------------\\n // Admin methods\\n // ----------------------------------------\\n\\n /**\\n * @notice Change or add eligible paths and their addresses.\\n * @param _tokenSymbol The symbol of the token to add\\n * @param _path The path of the path to add\\n */\\n function addPath(\\n string memory _tokenSymbol,\\n address[] memory _path\\n ) public virtual onlyOwner {\\n eligibleSwapPaths[_path[0]] = _path;\\n eligibleSwapPathsBySymbol[_tokenSymbol] = _path;\\n tokenSymbolsForPaths.push(_tokenSymbol);\\n }\\n\\n /**\\n * @notice Delete eligible tokens stored in the contract.\\n * @param _tokenSymbol The symbol of the path to remove\\n */\\n function removePath(string memory _tokenSymbol) public virtual onlyOwner {\\n delete eligibleSwapPaths[eligibleSwapPathsBySymbol[_tokenSymbol][0]];\\n delete eligibleSwapPathsBySymbol[_tokenSymbol];\\n }\\n\\n /**\\n * @notice Change or add pool token addresses.\\n * @param _poolToken The address of the pool token to add\\n */\\n function addPoolToken(address _poolToken) public virtual onlyOwner {\\n poolAddresses.push(_poolToken);\\n }\\n\\n /**\\n * @notice Delete eligible pool token addresses stored in the contract.\\n * @param _poolToken The address of the pool token to remove\\n */\\n function removePoolToken(address _poolToken) public virtual onlyOwner {\\n for (uint256 i; i < poolAddresses.length; i++) {\\n if (poolAddresses[i] == _poolToken) {\\n poolAddresses[i] = poolAddresses[poolAddresses.length - 1];\\n poolAddresses.pop();\\n break;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x00812c8474fe0303b130513d22e4a8cf4866cb16c3a5099203ef3fd769dc1f8a\",\"license\":\"GPL-3.0\"},\"contracts/OffsetHelperStorage.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2022 Toucan Labs\\n//\\n// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\n\\ncontract OffsetHelperStorage is OwnableUpgradeable {\\n // token symbol => token address\\n mapping(address => address[]) public eligibleSwapPaths;\\n mapping(string => address[]) public eligibleSwapPathsBySymbol;\\n\\n address public dexRouterAddress;\\n\\n address[] public poolAddresses;\\n string[] public tokenSymbolsForPaths;\\n address[][] public paths;\\n\\n // user => (token => amount)\\n mapping(address => mapping(address => uint256)) public balances;\\n}\\n\",\"keccak256\":\"0xd505f00a17446ca29983779a8febff10114173db7f47ca4300d6a0bfce6b957a\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IToucanCarbonOffsets.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\\\";\\n\\nimport \\\"../types/CarbonProjectTypes.sol\\\";\\nimport \\\"../types/CarbonProjectVintageTypes.sol\\\";\\n\\ninterface IToucanCarbonOffsets is IERC20Upgradeable, IERC721Receiver {\\n function getGlobalProjectVintageIdentifiers()\\n external\\n view\\n returns (string memory, string memory);\\n\\n function getAttributes()\\n external\\n view\\n returns (ProjectData memory, VintageData memory);\\n\\n function getRemaining() external view returns (uint256 remaining);\\n\\n function getDepositCap() external view returns (uint256);\\n\\n function retire(uint256 amount) external;\\n\\n function retireFrom(address account, uint256 amount) external;\\n\\n function mintCertificateLegacy(\\n string calldata retiringEntityString,\\n address beneficiary,\\n string calldata beneficiaryString,\\n string calldata retirementMessage,\\n uint256 amount\\n ) external;\\n\\n function retireAndMintCertificate(\\n string calldata retiringEntityString,\\n address beneficiary,\\n string calldata beneficiaryString,\\n string calldata retirementMessage,\\n uint256 amount\\n ) external;\\n}\\n\",\"keccak256\":\"0x46c4ed2acd84764d0dd68c9c475e2c6ec3229a686046db48aca77ccd298d4b48\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/IToucanContractRegistry.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\npragma solidity ^0.8.0;\\n\\ninterface IToucanContractRegistry {\\n function carbonOffsetBatchesAddress() external view returns (address);\\n\\n function carbonProjectsAddress() external view returns (address);\\n\\n function carbonProjectVintagesAddress() external view returns (address);\\n\\n function toucanCarbonOffsetsFactoryAddress()\\n external\\n view\\n returns (address);\\n\\n function carbonOffsetBadgesAddress() external view returns (address);\\n\\n function checkERC20(address _address) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xa8451ff2527948e4eed26e97247b979212ccb3bd89506302b6c09ddbad392035\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/IToucanPoolToken.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\n\\ninterface IToucanPoolToken is IERC20Upgradeable {\\n function deposit(address erc20Addr, uint256 amount) external;\\n\\n function checkEligible(address erc20Addr) external view returns (bool);\\n\\n function checkAttributeMatching(address erc20Addr)\\n external\\n view\\n returns (bool);\\n\\n function calculateRedeemFees(\\n address[] memory tco2s,\\n uint256[] memory amounts\\n ) external view returns (uint256);\\n\\n function redeemMany(address[] memory tco2s, uint256[] memory amounts)\\n external;\\n\\n function redeemAuto(uint256 amount) external;\\n\\n function redeemAuto2(uint256 amount)\\n external\\n returns (address[] memory tco2s, uint256[] memory amounts);\\n\\n function getRemaining() external view returns (uint256);\\n\\n function getScoredTCO2s() external view returns (address[] memory);\\n}\\n\",\"keccak256\":\"0xef39949a81cf4ed78d789a1aac5c5860de1582be70de7435f1671931091d43a7\",\"license\":\"UNLICENSED\"},\"contracts/types/CarbonProjectTypes.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @dev CarbonProject related data and attributes\\nstruct ProjectData {\\n string projectId;\\n string standard;\\n string methodology;\\n string region;\\n string storageMethod;\\n string method;\\n string emissionType;\\n string category;\\n string uri;\\n address controller;\\n}\\n\",\"keccak256\":\"0x10d52f79d4bb8dbfe0abbb1662059d6d0193fe5794977b66aacf741451e25401\",\"license\":\"UNLICENSED\"},\"contracts/types/CarbonProjectVintageTypes.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\nstruct VintageData {\\n /// @dev A human-readable string which differentiates this from other vintages in\\n /// the same project, and helps build the corresponding TCO2 name and symbol.\\n string name;\\n uint64 startTime; // UNIX timestamp\\n uint64 endTime; // UNIX timestamp\\n uint256 projectTokenId;\\n uint64 totalVintageQuantity;\\n bool isCorsiaCompliant;\\n bool isCCPcompliant;\\n string coBenefits;\\n string correspAdjustment;\\n string additionalCertification;\\n string uri;\\n}\\n\",\"keccak256\":\"0x3a52e88a48b87f1ca3992c201f8b786ccf3aeb74796510893f8e33b33eae251b\",\"license\":\"UNLICENSED\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506040516200416338038062004163833981016040819052620000349162000585565b606780546001600160a01b0319166001600160a01b038316179055835162000064906068906020870190620001fd565b5082516200007a90606990602086019062000267565b5081516200009090606a906020850190620002c7565b5082516000905b80821015620001f157838281518110620000c157634e487b7160e01b600052603260045260246000fd5b602002602001015160656000868581518110620000ee57634e487b7160e01b600052603260045260246000fd5b60200260200101516000815181106200011757634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020908051906020019062000154929190620001fd565b508382815181106200017657634e487b7160e01b600052603260045260246000fd5b60200260200101516066868481518110620001a157634e487b7160e01b600052603260045260246000fd5b6020026020010151604051620001b89190620006fc565b90815260200160405180910390209080519060200190620001db929190620001fd565b50620001e960018362000773565b915062000097565b5050505050506200081e565b82805482825590600052602060002090810192821562000255579160200282015b828111156200025557825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906200021e565b506200026392915062000327565b5090565b828054828255906000526020600020908101928215620002b9579160200282015b82811115620002b95782518051620002a89184916020909101906200033e565b509160200191906001019062000288565b5062000263929150620003bb565b82805482825590600052602060002090810192821562000319579160200282015b8281111562000319578251805162000308918491602090910190620001fd565b5091602001919060010190620002e8565b5062000263929150620003dc565b5b8082111562000263576000815560010162000328565b8280546200034c90620007cb565b90600052602060002090601f01602090048101928262000370576000855562000255565b82601f106200038b57805160ff191683800117855562000255565b8280016001018555821562000255579182015b82811115620002555782518255916020019190600101906200039e565b8082111562000263576000620003d28282620003fd565b50600101620003bb565b8082111562000263576000620003f382826200043f565b50600101620003dc565b5080546200040b90620007cb565b6000825580601f106200041c575050565b601f0160209004906000526020600020908101906200043c919062000327565b50565b50805460008255906000526020600020908101906200043c919062000327565b80516001600160a01b03811681146200047757600080fd5b919050565b600082601f8301126200048d578081fd5b81516020620004a6620004a0836200074d565b6200071a565b80838252828201915082860187848660051b8901011115620004c6578586fd5b855b85811015620004ef57620004dc826200045f565b84529284019290840190600101620004c8565b5090979650505050505050565b600082601f8301126200050d578081fd5b8151602062000520620004a0836200074d565b80838252828201915082860187848660051b890101111562000540578586fd5b855b85811015620004ef5781516001600160401b0381111562000561578788fd5b620005718a87838c01016200047c565b855250928401929084019060010162000542565b600080600080608085870312156200059b578384fd5b84516001600160401b0380821115620005b2578586fd5b620005c0888389016200047c565b95506020870151915080821115620005d6578485fd5b818701915087601f830112620005ea578485fd5b8151620005fb620004a0826200074d565b80828252602082019150602085018b60208560051b88010111156200061e578889fd5b885b84811015620006b65781518681111562000638578a8bfd5b8701603f81018e1362000649578a8bfd5b60208101518781111562000661576200066162000808565b62000676601f8201601f19166020016200071a565b8181528f60408385010111156200068b578c8dfd5b6200069e82602083016040860162000798565b86525050602093840193919091019060010162000620565b505060408a01519097509350505080821115620006d1578384fd5b50620006e087828801620004fc565b925050620006f1606086016200045f565b905092959194509250565b600082516200071081846020870162000798565b9190910192915050565b604051601f8201601f191681016001600160401b038111828210171562000745576200074562000808565b604052919050565b60006001600160401b0382111562000769576200076962000808565b5060051b60200190565b600082198211156200079357634e487b7160e01b81526011600452602481fd5b500190565b60005b83811015620007b55781810151838201526020016200079b565b83811115620007c5576000848401525b50505050565b600181811c90821680620007e057607f821691505b602082108114156200080257634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b613935806200082e6000396000f3fe6080604052600436106101e55760003560e01c80638da5cb5b11610101578063c23f001f1161009a578063e7f67fb11161006c578063e7f67fb1146105ca578063f04ad9d7146105ea578063f2fde38b146105fd578063f3fef3a31461061d578063feb21b9c1461063d57005b8063c23f001f1461053f578063c6c53efb14610577578063d08ec47514610597578063d8a90c40146105b757005b8063a2844a86116100d3578063a2844a86146104af578063b4e76a86146104df578063b8baf9db146104ff578063c0681c3d1461051f57005b80638da5cb5b146104315780639753209d1461044f578063a09457221461046f578063a0cd60491461048f57005b80635367cd9c1161017e578063715018a611610150578063715018a6146103a757806373200b11146103bc5780638129fc1c146103dc57806382155e7e146103f15780638474c2881461041157005b80635367cd9c1461031a57806356a7de0d1461032d57806368d306d91461034d5780636d4565041461037a57005b80632e98c814116101b75780632e98c8141461029957806335bab7e5146102ba57806347e7ef24146102da5780634865b2b4146102fa57005b80631109ec99146101ee5780631357b113146102215780631661f818146102595780631a0fdecc1461027957005b366101ec57005b005b3480156101fa57600080fd5b5061020e6102093660046131f5565b61065d565b6040519081526020015b60405180910390f35b34801561022d57600080fd5b5061024161023c3660046131f5565b610753565b6040516001600160a01b039091168152602001610218565b34801561026557600080fd5b506101ec610274366004613220565b61078b565b34801561028557600080fd5b5061020e6102943660046131b5565b610a7d565b6102ac6102a73660046131f5565b610b10565b6040516102189291906135f2565b3480156102c657600080fd5b5061020e6102d53660046131b5565b610b5f565b3480156102e657600080fd5b506101ec6102f53660046131f5565b610d0a565b34801561030657600080fd5b5061020e6103153660046131b5565b610d82565b6101ec6103283660046131f5565b610e0d565b34801561033957600080fd5b506101ec61034836600461315a565b6110bd565b34801561035957600080fd5b5061036d61036836600461315a565b611209565b60405161021891906135df565b34801561038657600080fd5b5061039a6103953660046134c2565b61127f565b6040516102189190613655565b3480156103b357600080fd5b506101ec61132b565b3480156103c857600080fd5b506102416103d736600461347f565b61133f565b3480156103e857600080fd5b506101ec61136a565b3480156103fd57600080fd5b506102ac61040c3660046131f5565b61147b565b34801561041d57600080fd5b506101ec61042c3660046131b5565b6116e7565b34801561043d57600080fd5b506033546001600160a01b0316610241565b34801561045b57600080fd5b506101ec61046a3660046133f5565b6119ab565b34801561047b57600080fd5b506102ac61048a3660046131b5565b611a4c565b34801561049b57600080fd5b506102ac6104aa3660046131b5565b611a80565b3480156104bb57600080fd5b506104cf6104ca36600461315a565b611aaf565b6040519015158152602001610218565b3480156104eb57600080fd5b5061020e6104fa3660046131f5565b611ac0565b34801561050b57600080fd5b506101ec61051a366004613428565b611ba6565b34801561052b57600080fd5b506101ec61053a36600461315a565b611c8b565b34801561054b57600080fd5b5061020e61055a36600461317d565b606b60209081526000928352604080842090915290825290205481565b34801561058357600080fd5b506102416105923660046134f2565b611ce5565b3480156105a357600080fd5b506102ac6105b23660046131f5565b611d0d565b61020e6105c536600461315a565b611d1a565b3480156105d657600080fd5b50606754610241906001600160a01b031681565b6102ac6105f836600461315a565b611eec565b34801561060957600080fd5b506101ec61061836600461315a565b611f3d565b34801561062957600080fd5b506101ec6106383660046131f5565b611fb3565b34801561064957600080fd5b506102416106583660046134c2565b61206d565b600061a4ec46141561068a5760405162461bcd60e51b815260040161068190613688565b60405180910390fd5b8261069481612097565b6106b05760405162461bcd60e51b81526004016106819061370d565b600060666040516106cd9065574d4154494360d01b815260060190565b90815260200160405180910390206000815481106106fb57634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b0316915061071c82878761210f565b9150508060008151811061074057634e487b7160e01b600052603260045260246000fd5b6020026020010151935050505092915050565b6065602052816000526040600020818154811061076f57600080fd5b6000918252602090912001546001600160a01b03169150829050565b8151806107c85760405162461bcd60e51b815260206004820152600b60248201526a417272617920656d70747960a81b6044820152606401610681565b815181146107e85760405162461bcd60e51b81526004016106819061373b565b60005b81811015610a775782818151811061081357634e487b7160e01b600052603260045260246000fd5b60200260200101516000141561082b576001016107eb565b82818151811061084b57634e487b7160e01b600052603260045260246000fd5b6020026020010151606b6000336001600160a01b03166001600160a01b03168152602001908152602001600020600086848151811061089a57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000205410156109115760405162461bcd60e51b815260206004820152601960248201527f496e73756666696369656e742054434f322062616c616e6365000000000000006044820152606401610681565b82818151811061093157634e487b7160e01b600052603260045260246000fd5b6020026020010151606b6000336001600160a01b03166001600160a01b03168152602001908152602001600020600086848151811061098057634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060008282546109b79190613825565b925050819055508381815181106109de57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316633790cf57848381518110610a1457634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b8152600401610a3a91815260200190565b600060405180830381600087803b158015610a5457600080fd5b505af1158015610a68573d6000803e3d6000fd5b505050508060010190506107eb565b50505050565b600083610a898161224f565b610aa55760405162461bcd60e51b8152600401610681906136d6565b83610aaf81612097565b610acb5760405162461bcd60e51b81526004016106819061370d565b6000610ad887878761210f565b91505080600081518110610afc57634e487b7160e01b600052603260045260246000fd5b602002602001015193505050509392505050565b60608061a4ec461415610b355760405162461bcd60e51b815260040161068190613688565b610b3f8484610e0d565b610b49848461147b565b9092509050610b58828261078b565b9250929050565b600083610b6b8161224f565b610b875760405162461bcd60e51b8152600401610681906136d6565b83610b9181612097565b610bad5760405162461bcd60e51b81526004016106819061370d565b6000610bb987876122e8565b8051909150610bd36001600160a01b03891633308961289a565b606754610bed906001600160a01b038a8116911688612905565b6000610c016067546001600160a01b031690565b6001600160a01b03166338ed17398860008630426040518663ffffffff1660e01b8152600401610c3595949392919061377c565b600060405180830381600087803b158015610c4f57600080fd5b505af1158015610c63573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c8b91908101906133a2565b905080610c99600184613825565b81518110610cb757634e487b7160e01b600052603260045260246000fd5b602090810291909101810151336000908152606b835260408082206001600160a01b038d168352909352918220805491985088929091610cf890849061380d565b90915550959998505050505050505050565b81610d1481612097565b610d305760405162461bcd60e51b81526004016106819061370d565b610d456001600160a01b03841633308561289a565b336000908152606b602090815260408083206001600160a01b038716845290915281208054849290610d7890849061380d565b9091555050505050565b600083610d8e8161224f565b610daa5760405162461bcd60e51b8152600401610681906136d6565b83610db481612097565b610dd05760405162461bcd60e51b81526004016106819061370d565b6000610ddd878787612a29565b9150508060018251610def9190613825565b81518110610afc57634e487b7160e01b600052603260045260246000fd5b61a4ec461415610e2f5760405162461bcd60e51b815260040161068190613688565b81610e3981612097565b610e555760405162461bcd60e51b81526004016106819061370d565b60006066604051610e729065574d4154494360d01b815260060190565b9081526020016040518091039020600081548110610ea057634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b03169150610ec082866122e8565b90506000610ed66067546001600160a01b031690565b6001600160a01b031663fb3bdb4134878530426040518663ffffffff1660e01b8152600401610f089493929190613620565b6000604051808303818588803b158015610f2157600080fd5b505af1158015610f35573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052610f5e91908101906133a2565b905080600081518110610f8157634e487b7160e01b600052603260045260246000fd5b602002602001015134111561107d57600081600081518110610fb357634e487b7160e01b600052603260045260246000fd5b602002602001015134610fc69190613825565b604080516000808252602082019283905292935033918491610fe791613585565b60006040518083038185875af1925050503d8060008114611024576040519150601f19603f3d011682016040523d82523d6000602084013e611029565b606091505b505090508061107a5760405162461bcd60e51b815260206004820152601b60248201527f4661696c656420746f2073656e6420737572706c7573206261636b00000000006044820152606401610681565b50505b336000908152606b602090815260408083206001600160a01b038a168452909152812080548792906110b090849061380d565b9091555050505050505050565b6110c5612b5f565b60005b60685481101561120557816001600160a01b0316606882815481106110fd57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156111f3576068805461112890600190613825565b8154811061114657634e487b7160e01b600052603260045260246000fd5b600091825260209091200154606880546001600160a01b03909216918390811061118057634e487b7160e01b600052603260045260246000fd5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060688054806111cd57634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b03191690550190555050565b806111fd816138a3565b9150506110c8565b5050565b6001600160a01b03811660009081526065602090815260409182902080548351818402810184019094528084526060939283018282801561127357602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611255575b50505050509050919050565b6069818154811061128f57600080fd5b9060005260206000200160009150905080546112aa90613868565b80601f01602080910402602001604051908101604052809291908181526020018280546112d690613868565b80156113235780601f106112f857610100808354040283529160200191611323565b820191906000526020600020905b81548152906001019060200180831161130657829003601f168201915b505050505081565b611333612b5f565b61133d6000612bb9565b565b8151602081840181018051606682529282019185019190912091905280548290811061076f57600080fd5b600054610100900460ff161580801561138a5750600054600160ff909116105b806113a45750303b1580156113a4575060005460ff166001145b6114075760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610681565b6000805460ff19166001179055801561142a576000805461ff0019166101001790555b611432612c0b565b8015611478576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50565b6060808361148881612097565b6114a45760405162461bcd60e51b81526004016106819061370d565b336000908152606b602090815260408083206001600160a01b03891684529091529020548411156115175760405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e74204e43542f4243542062616c616e6365000000006044820152606401610681565b604051634c02cad160e01b81526004810185905285906001600160a01b03821690634c02cad190602401600060405180830381600087803b15801561155b57600080fd5b505af115801561156f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261159791908101906132dc565b336000908152606b602090815260408083206001600160a01b038c1684529091528120805493975091955087926115cf908490613825565b9091555050835160005b8181101561169f5784818151811061160157634e487b7160e01b600052603260045260246000fd5b6020026020010151606b6000336001600160a01b03166001600160a01b03168152602001908152602001600020600088848151811061165057634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206000828254611687919061380d565b90915550819050611697816138a3565b9150506115d9565b507f3d29f82a20ec733db9f357c4dc1ae0ee60c572cc4b877384aa4639e4d877b188338887876040516116d594939291906135a1565b60405180910390a15050509250929050565b826116f18161224f565b61170d5760405162461bcd60e51b8152600401610681906136d6565b8261171781612097565b6117335760405162461bcd60e51b81526004016106819061370d565b60008061174187878761210f565b9150915060008160008151811061176857634e487b7160e01b600052603260045260246000fd5b6020908102919091010151905061178a6001600160a01b03891633308461289a565b60675460405163095ea7b360e01b81526001600160a01b039182166004820152602481018390529089169063095ea7b390604401602060405180830381600087803b1580156117d857600080fd5b505af11580156117ec573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061181091906133d5565b5060006118256067546001600160a01b031690565b6001600160a01b0316638803dbee88848730426040518663ffffffff1660e01b815260040161185895949392919061377c565b600060405180830381600087803b15801561187257600080fd5b505af1158015611886573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526118ae91908101906133a2565b905081816000815181106118d257634e487b7160e01b600052603260045260246000fd5b602002602001015110156119685760675460405163095ea7b360e01b81526001600160a01b03918216600482015260006024820152908a169063095ea7b390604401602060405180830381600087803b15801561192e57600080fd5b505af1158015611942573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061196691906133d5565b505b336000908152606b602090815260408083206001600160a01b038c1684529091528120805489929061199b90849061380d565b9091555050505050505050505050565b6119b3612b5f565b606560006066836040516119c79190613585565b90815260200160405180910390206000815481106119f557634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528201929092526040018120611a2291612f0e565b606681604051611a329190613585565b908152602001604051809103902060006114789190612f0e565b6060806000611a5c868686610b5f565b9050611a68858261147b565b9093509150611a77838361078b565b50935093915050565b606080611a8e8585856116e7565b611a98848461147b565b9092509050611aa7828261078b565b935093915050565b6000611aba82612097565b92915050565b600061a4ec461415611ae45760405162461bcd60e51b815260040161068190613688565b82611aee81612097565b611b0a5760405162461bcd60e51b81526004016106819061370d565b60006066604051611b279065574d4154494360d01b815260060190565b9081526020016040518091039020600081548110611b5557634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b03169150611b76828787612a29565b9150508060018251611b889190613825565b8151811061074057634e487b7160e01b600052603260045260246000fd5b611bae612b5f565b806065600083600081518110611bd457634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000209080519060200190611c0f929190612f2c565b5080606683604051611c219190613585565b90815260200160405180910390209080519060200190611c42929190612f2c565b50606980546001810182556000919091528251611c86917f7fb4302e8e91f9110a6554c2c0a24601252c2a42c2220ca988efcfe39991430801906020850190612f91565b505050565b611c93612b5f565b606880546001810182556000919091527fa2153420d844928b4421650203c77babc8b33d7f2e7b450e2966db0c220977530180546001600160a01b0319166001600160a01b0392909216919091179055565b606a8281548110611cf557600080fd5b90600052602060002001818154811061076f57600080fd5b606080610b3f8484610d0a565b600061a4ec461415611d3e5760405162461bcd60e51b815260040161068190613688565b81611d4881612097565b611d645760405162461bcd60e51b81526004016106819061370d565b60405165574d4154494360d01b815234906000906066906006019081526020016040518091039020600081548110611dac57634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b03169150611dcc82876122e8565b80519091506000611de56067546001600160a01b031690565b6001600160a01b0316637ff36ab58660008630426040518663ffffffff1660e01b8152600401611e189493929190613620565b6000604051808303818588803b158015611e3157600080fd5b505af1158015611e45573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052611e6e91908101906133a2565b905080611e7c600184613825565b81518110611e9a57634e487b7160e01b600052603260045260246000fd5b602090810291909101810151336000908152606b835260408082206001600160a01b038d168352909352918220805491995089929091611edb90849061380d565b909155509698975050505050505050565b60608061a4ec461415611f115760405162461bcd60e51b815260040161068190613688565b6000611f1c84611d1a565b9050611f28848261147b565b9093509150611f37838361078b565b50915091565b611f45612b5f565b6001600160a01b038116611faa5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610681565b61147881612bb9565b336000908152606b602090815260408083206001600160a01b038616845290915290205481111561201d5760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b6044820152606401610681565b6120316001600160a01b0383163383612c7f565b336000908152606b602090815260408083206001600160a01b038616845290915281208054839290612064908490613825565b90915550505050565b6068818154811061207d57600080fd5b6000918252602090912001546001600160a01b0316905081565b6000805b60685481101561210657826001600160a01b0316606882815481106120d057634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156120f45750600192915050565b806120fe816138a3565b91505061209b565b50600092915050565b60608061211c85856122e8565b80519092506121336067546001600160a01b031690565b6001600160a01b0316631f00ca7485856040518363ffffffff1660e01b8152600401612160929190613763565b60006040518083038186803b15801561217857600080fd5b505afa15801561218c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526121b491908101906133a2565b9150815181146121d65760405162461bcd60e51b81526004016106819061373b565b816121e2600183613825565b8151811061220057634e487b7160e01b600052603260045260246000fd5b60200260200101518414611a775760405162461bcd60e51b815260206004820152601660248201527509eeae8e0eae840c2dadeeadce840dad2e6dac2e8c6d60531b6044820152606401610681565b6000805b606a5481101561210657826001600160a01b0316606a828154811061228857634e487b7160e01b600052603260045260246000fd5b906000526020600020016000815481106122b257634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156122d65750600192915050565b806122e0816138a3565b915050612253565b6001600160a01b03821660009081526065602052604090205460609060018114156123b7576040805160028082526060820183529091602083019080368337019050509150838260008151811061234f57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050828260018151811061239157634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505050611aba565b80600214156124d057604080516003808252608082019092529060208201606080368337019050509150838260008151811061240357634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600190811061244f57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260018151811061248e57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050828260028151811061239157634e487b7160e01b600052603260045260246000fd5b806003141561267457604080516003808252608082019092529060208201606080368337019050509150838260008151811061251c57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600190811061256857634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826001815181106125a757634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092018101919091529085166000908152606590915260409020805460029081106125f357634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260028151811061263257634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050828260038151811061239157634e487b7160e01b600052603260045260246000fd5b60408051600480825260a08201909252906020820160808036833701905050915083826000815181106126b757634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600190811061270357634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260018151811061274257634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600290811061278e57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826002815181106127cd57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600390811061281957634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260038151811061285857634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050828260048151811061239157634e487b7160e01b600052603260045260246000fd5b6040516001600160a01b0380851660248301528316604482015260648101829052610a779085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612caf565b80158061298e5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561295457600080fd5b505afa158015612968573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061298c91906134da565b155b6129f95760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610681565b6040516001600160a01b038316602482015260448101829052611c8690849063095ea7b360e01b906064016128ce565b606080612a3685856122e8565b8051909250612a4d6067546001600160a01b031690565b6001600160a01b031663d06ca61f85856040518363ffffffff1660e01b8152600401612a7a929190613763565b60006040518083038186803b158015612a9257600080fd5b505afa158015612aa6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612ace91908101906133a2565b915081518114612af05760405162461bcd60e51b81526004016106819061373b565b81600081518110612b1157634e487b7160e01b600052603260045260246000fd5b60200260200101518414611a775760405162461bcd60e51b8152602060048201526015602482015274092dce0eae840c2dadeeadce840dad2e6dac2e8c6d605b1b6044820152606401610681565b6033546001600160a01b0316331461133d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610681565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16612c765760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610681565b61133d33612bb9565b6040516001600160a01b038316602482015260448101829052611c8690849063a9059cbb60e01b906064016128ce565b6000612d04826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612d819092919063ffffffff16565b805190915015611c865780806020019051810190612d2291906133d5565b611c865760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610681565b6060612d908484600085612d98565b949350505050565b606082471015612df95760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610681565b600080866001600160a01b03168587604051612e159190613585565b60006040518083038185875af1925050503d8060008114612e52576040519150601f19603f3d011682016040523d82523d6000602084013e612e57565b606091505b5091509150612e6887838387612e73565b979650505050505050565b60608315612edf578251612ed8576001600160a01b0385163b612ed85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610681565b5081612d90565b612d908383815115612ef45781518083602001fd5b8060405162461bcd60e51b81526004016106819190613655565b50805460008255906000526020600020908101906114789190613005565b828054828255906000526020600020908101928215612f81579160200282015b82811115612f8157825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190612f4c565b50612f8d929150613005565b5090565b828054612f9d90613868565b90600052602060002090601f016020900481019282612fbf5760008555612f81565b82601f10612fd857805160ff1916838001178555612f81565b82800160010185558215612f81579182015b82811115612f81578251825591602001919060010190612fea565b5b80821115612f8d5760008155600101613006565b600082601f83011261302a578081fd5b8135602061303f61303a836137e9565b6137b8565b80838252828201915082860187848660051b890101111561305e578586fd5b855b85811015613085578135613073816138ea565b84529284019290840190600101613060565b5090979650505050505050565b600082601f8301126130a2578081fd5b815160206130b261303a836137e9565b80838252828201915082860187848660051b89010111156130d1578586fd5b855b85811015613085578151845292840192908401906001016130d3565b600082601f8301126130ff578081fd5b813567ffffffffffffffff811115613119576131196138d4565b61312c601f8201601f19166020016137b8565b818152846020838601011115613140578283fd5b816020850160208301379081016020019190915292915050565b60006020828403121561316b578081fd5b8135613176816138ea565b9392505050565b6000806040838503121561318f578081fd5b823561319a816138ea565b915060208301356131aa816138ea565b809150509250929050565b6000806000606084860312156131c9578081fd5b83356131d4816138ea565b925060208401356131e4816138ea565b929592945050506040919091013590565b60008060408385031215613207578182fd5b8235613212816138ea565b946020939093013593505050565b60008060408385031215613232578182fd5b823567ffffffffffffffff80821115613249578384fd5b6132558683870161301a565b935060209150818501358181111561326b578384fd5b85019050601f8101861361327d578283fd5b803561328b61303a826137e9565b80828252848201915084840189868560051b87010111156132aa578687fd5b8694505b838510156132cc5780358352600194909401939185019185016132ae565b5080955050505050509250929050565b600080604083850312156132ee578182fd5b825167ffffffffffffffff80821115613305578384fd5b818501915085601f830112613318578384fd5b8151602061332861303a836137e9565b8083825282820191508286018a848660051b8901011115613347578889fd5b8896505b8487101561337257805161335e816138ea565b83526001969096019591830191830161334b565b509188015191965090935050508082111561338b578283fd5b5061339885828601613092565b9150509250929050565b6000602082840312156133b3578081fd5b815167ffffffffffffffff8111156133c9578182fd5b612d9084828501613092565b6000602082840312156133e6578081fd5b81518015158114613176578182fd5b600060208284031215613406578081fd5b813567ffffffffffffffff81111561341c578182fd5b612d90848285016130ef565b6000806040838503121561343a578182fd5b823567ffffffffffffffff80821115613451578384fd5b61345d868387016130ef565b93506020850135915080821115613472578283fd5b506133988582860161301a565b60008060408385031215613491578182fd5b823567ffffffffffffffff8111156134a7578283fd5b6134b3858286016130ef565b95602094909401359450505050565b6000602082840312156134d3578081fd5b5035919050565b6000602082840312156134eb578081fd5b5051919050565b60008060408385031215613504578182fd5b50508035926020909101359150565b6000815180845260208085019450808401835b8381101561354b5781516001600160a01b031687529582019590820190600101613526565b509495945050505050565b6000815180845260208085019450808401835b8381101561354b57815187529582019590820190600101613569565b6000825161359781846020870161383c565b9190910192915050565b6001600160a01b038581168252841660208201526080604082018190526000906135cd90830185613513565b8281036060840152612e688185613556565b6020815260006131766020830184613513565b6040815260006136056040830185613513565b82810360208401526136178185613556565b95945050505050565b8481526080602082015260006136396080830186613513565b6001600160a01b03949094166040830152506060015292915050565b602081526000825180602084015261367481604085016020870161383c565b601f01601f19169190910160400192915050565b6020808252602e908201527f5468652066756e6374696f6e206973206e6f7420617661696c61626c65206f6e60408201526d103a3434b9903732ba3bb7b9359760911b606082015260800190565b60208082526018908201527f5061746820646f65736e277420796574206578697374732e0000000000000000604082015260600190565b602080825260149082015273546f6b656e206e6f742072656465656d61626c6560601b604082015260600190565b6020808252600e908201526d105c9c985e5cc81d5b995c5d585b60921b604082015260600190565b828152604060208201526000612d906040830184613513565b85815284602082015260a06040820152600061379b60a0830186613513565b6001600160a01b0394909416606083015250608001529392505050565b604051601f8201601f1916810167ffffffffffffffff811182821017156137e1576137e16138d4565b604052919050565b600067ffffffffffffffff821115613803576138036138d4565b5060051b60200190565b60008219821115613820576138206138be565b500190565b600082821015613837576138376138be565b500390565b60005b8381101561385757818101518382015260200161383f565b83811115610a775750506000910152565b600181811c9082168061387c57607f821691505b6020821081141561389d57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156138b7576138b76138be565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461147857600080fdfea26469706673582212200f2bb74b64168c68a4845864d66a79cf1c4ab79c19c33d5a3cd70163e4a3de7564736f6c63430008040033", - "deployedBytecode": "0x6080604052600436106101e55760003560e01c80638da5cb5b11610101578063c23f001f1161009a578063e7f67fb11161006c578063e7f67fb1146105ca578063f04ad9d7146105ea578063f2fde38b146105fd578063f3fef3a31461061d578063feb21b9c1461063d57005b8063c23f001f1461053f578063c6c53efb14610577578063d08ec47514610597578063d8a90c40146105b757005b8063a2844a86116100d3578063a2844a86146104af578063b4e76a86146104df578063b8baf9db146104ff578063c0681c3d1461051f57005b80638da5cb5b146104315780639753209d1461044f578063a09457221461046f578063a0cd60491461048f57005b80635367cd9c1161017e578063715018a611610150578063715018a6146103a757806373200b11146103bc5780638129fc1c146103dc57806382155e7e146103f15780638474c2881461041157005b80635367cd9c1461031a57806356a7de0d1461032d57806368d306d91461034d5780636d4565041461037a57005b80632e98c814116101b75780632e98c8141461029957806335bab7e5146102ba57806347e7ef24146102da5780634865b2b4146102fa57005b80631109ec99146101ee5780631357b113146102215780631661f818146102595780631a0fdecc1461027957005b366101ec57005b005b3480156101fa57600080fd5b5061020e6102093660046131f5565b61065d565b6040519081526020015b60405180910390f35b34801561022d57600080fd5b5061024161023c3660046131f5565b610753565b6040516001600160a01b039091168152602001610218565b34801561026557600080fd5b506101ec610274366004613220565b61078b565b34801561028557600080fd5b5061020e6102943660046131b5565b610a7d565b6102ac6102a73660046131f5565b610b10565b6040516102189291906135f2565b3480156102c657600080fd5b5061020e6102d53660046131b5565b610b5f565b3480156102e657600080fd5b506101ec6102f53660046131f5565b610d0a565b34801561030657600080fd5b5061020e6103153660046131b5565b610d82565b6101ec6103283660046131f5565b610e0d565b34801561033957600080fd5b506101ec61034836600461315a565b6110bd565b34801561035957600080fd5b5061036d61036836600461315a565b611209565b60405161021891906135df565b34801561038657600080fd5b5061039a6103953660046134c2565b61127f565b6040516102189190613655565b3480156103b357600080fd5b506101ec61132b565b3480156103c857600080fd5b506102416103d736600461347f565b61133f565b3480156103e857600080fd5b506101ec61136a565b3480156103fd57600080fd5b506102ac61040c3660046131f5565b61147b565b34801561041d57600080fd5b506101ec61042c3660046131b5565b6116e7565b34801561043d57600080fd5b506033546001600160a01b0316610241565b34801561045b57600080fd5b506101ec61046a3660046133f5565b6119ab565b34801561047b57600080fd5b506102ac61048a3660046131b5565b611a4c565b34801561049b57600080fd5b506102ac6104aa3660046131b5565b611a80565b3480156104bb57600080fd5b506104cf6104ca36600461315a565b611aaf565b6040519015158152602001610218565b3480156104eb57600080fd5b5061020e6104fa3660046131f5565b611ac0565b34801561050b57600080fd5b506101ec61051a366004613428565b611ba6565b34801561052b57600080fd5b506101ec61053a36600461315a565b611c8b565b34801561054b57600080fd5b5061020e61055a36600461317d565b606b60209081526000928352604080842090915290825290205481565b34801561058357600080fd5b506102416105923660046134f2565b611ce5565b3480156105a357600080fd5b506102ac6105b23660046131f5565b611d0d565b61020e6105c536600461315a565b611d1a565b3480156105d657600080fd5b50606754610241906001600160a01b031681565b6102ac6105f836600461315a565b611eec565b34801561060957600080fd5b506101ec61061836600461315a565b611f3d565b34801561062957600080fd5b506101ec6106383660046131f5565b611fb3565b34801561064957600080fd5b506102416106583660046134c2565b61206d565b600061a4ec46141561068a5760405162461bcd60e51b815260040161068190613688565b60405180910390fd5b8261069481612097565b6106b05760405162461bcd60e51b81526004016106819061370d565b600060666040516106cd9065574d4154494360d01b815260060190565b90815260200160405180910390206000815481106106fb57634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b0316915061071c82878761210f565b9150508060008151811061074057634e487b7160e01b600052603260045260246000fd5b6020026020010151935050505092915050565b6065602052816000526040600020818154811061076f57600080fd5b6000918252602090912001546001600160a01b03169150829050565b8151806107c85760405162461bcd60e51b815260206004820152600b60248201526a417272617920656d70747960a81b6044820152606401610681565b815181146107e85760405162461bcd60e51b81526004016106819061373b565b60005b81811015610a775782818151811061081357634e487b7160e01b600052603260045260246000fd5b60200260200101516000141561082b576001016107eb565b82818151811061084b57634e487b7160e01b600052603260045260246000fd5b6020026020010151606b6000336001600160a01b03166001600160a01b03168152602001908152602001600020600086848151811061089a57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000205410156109115760405162461bcd60e51b815260206004820152601960248201527f496e73756666696369656e742054434f322062616c616e6365000000000000006044820152606401610681565b82818151811061093157634e487b7160e01b600052603260045260246000fd5b6020026020010151606b6000336001600160a01b03166001600160a01b03168152602001908152602001600020600086848151811061098057634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060008282546109b79190613825565b925050819055508381815181106109de57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316633790cf57848381518110610a1457634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b8152600401610a3a91815260200190565b600060405180830381600087803b158015610a5457600080fd5b505af1158015610a68573d6000803e3d6000fd5b505050508060010190506107eb565b50505050565b600083610a898161224f565b610aa55760405162461bcd60e51b8152600401610681906136d6565b83610aaf81612097565b610acb5760405162461bcd60e51b81526004016106819061370d565b6000610ad887878761210f565b91505080600081518110610afc57634e487b7160e01b600052603260045260246000fd5b602002602001015193505050509392505050565b60608061a4ec461415610b355760405162461bcd60e51b815260040161068190613688565b610b3f8484610e0d565b610b49848461147b565b9092509050610b58828261078b565b9250929050565b600083610b6b8161224f565b610b875760405162461bcd60e51b8152600401610681906136d6565b83610b9181612097565b610bad5760405162461bcd60e51b81526004016106819061370d565b6000610bb987876122e8565b8051909150610bd36001600160a01b03891633308961289a565b606754610bed906001600160a01b038a8116911688612905565b6000610c016067546001600160a01b031690565b6001600160a01b03166338ed17398860008630426040518663ffffffff1660e01b8152600401610c3595949392919061377c565b600060405180830381600087803b158015610c4f57600080fd5b505af1158015610c63573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c8b91908101906133a2565b905080610c99600184613825565b81518110610cb757634e487b7160e01b600052603260045260246000fd5b602090810291909101810151336000908152606b835260408082206001600160a01b038d168352909352918220805491985088929091610cf890849061380d565b90915550959998505050505050505050565b81610d1481612097565b610d305760405162461bcd60e51b81526004016106819061370d565b610d456001600160a01b03841633308561289a565b336000908152606b602090815260408083206001600160a01b038716845290915281208054849290610d7890849061380d565b9091555050505050565b600083610d8e8161224f565b610daa5760405162461bcd60e51b8152600401610681906136d6565b83610db481612097565b610dd05760405162461bcd60e51b81526004016106819061370d565b6000610ddd878787612a29565b9150508060018251610def9190613825565b81518110610afc57634e487b7160e01b600052603260045260246000fd5b61a4ec461415610e2f5760405162461bcd60e51b815260040161068190613688565b81610e3981612097565b610e555760405162461bcd60e51b81526004016106819061370d565b60006066604051610e729065574d4154494360d01b815260060190565b9081526020016040518091039020600081548110610ea057634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b03169150610ec082866122e8565b90506000610ed66067546001600160a01b031690565b6001600160a01b031663fb3bdb4134878530426040518663ffffffff1660e01b8152600401610f089493929190613620565b6000604051808303818588803b158015610f2157600080fd5b505af1158015610f35573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052610f5e91908101906133a2565b905080600081518110610f8157634e487b7160e01b600052603260045260246000fd5b602002602001015134111561107d57600081600081518110610fb357634e487b7160e01b600052603260045260246000fd5b602002602001015134610fc69190613825565b604080516000808252602082019283905292935033918491610fe791613585565b60006040518083038185875af1925050503d8060008114611024576040519150601f19603f3d011682016040523d82523d6000602084013e611029565b606091505b505090508061107a5760405162461bcd60e51b815260206004820152601b60248201527f4661696c656420746f2073656e6420737572706c7573206261636b00000000006044820152606401610681565b50505b336000908152606b602090815260408083206001600160a01b038a168452909152812080548792906110b090849061380d565b9091555050505050505050565b6110c5612b5f565b60005b60685481101561120557816001600160a01b0316606882815481106110fd57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156111f3576068805461112890600190613825565b8154811061114657634e487b7160e01b600052603260045260246000fd5b600091825260209091200154606880546001600160a01b03909216918390811061118057634e487b7160e01b600052603260045260246000fd5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060688054806111cd57634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b03191690550190555050565b806111fd816138a3565b9150506110c8565b5050565b6001600160a01b03811660009081526065602090815260409182902080548351818402810184019094528084526060939283018282801561127357602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611255575b50505050509050919050565b6069818154811061128f57600080fd5b9060005260206000200160009150905080546112aa90613868565b80601f01602080910402602001604051908101604052809291908181526020018280546112d690613868565b80156113235780601f106112f857610100808354040283529160200191611323565b820191906000526020600020905b81548152906001019060200180831161130657829003601f168201915b505050505081565b611333612b5f565b61133d6000612bb9565b565b8151602081840181018051606682529282019185019190912091905280548290811061076f57600080fd5b600054610100900460ff161580801561138a5750600054600160ff909116105b806113a45750303b1580156113a4575060005460ff166001145b6114075760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610681565b6000805460ff19166001179055801561142a576000805461ff0019166101001790555b611432612c0b565b8015611478576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50565b6060808361148881612097565b6114a45760405162461bcd60e51b81526004016106819061370d565b336000908152606b602090815260408083206001600160a01b03891684529091529020548411156115175760405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e74204e43542f4243542062616c616e6365000000006044820152606401610681565b604051634c02cad160e01b81526004810185905285906001600160a01b03821690634c02cad190602401600060405180830381600087803b15801561155b57600080fd5b505af115801561156f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261159791908101906132dc565b336000908152606b602090815260408083206001600160a01b038c1684529091528120805493975091955087926115cf908490613825565b9091555050835160005b8181101561169f5784818151811061160157634e487b7160e01b600052603260045260246000fd5b6020026020010151606b6000336001600160a01b03166001600160a01b03168152602001908152602001600020600088848151811061165057634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206000828254611687919061380d565b90915550819050611697816138a3565b9150506115d9565b507f3d29f82a20ec733db9f357c4dc1ae0ee60c572cc4b877384aa4639e4d877b188338887876040516116d594939291906135a1565b60405180910390a15050509250929050565b826116f18161224f565b61170d5760405162461bcd60e51b8152600401610681906136d6565b8261171781612097565b6117335760405162461bcd60e51b81526004016106819061370d565b60008061174187878761210f565b9150915060008160008151811061176857634e487b7160e01b600052603260045260246000fd5b6020908102919091010151905061178a6001600160a01b03891633308461289a565b60675460405163095ea7b360e01b81526001600160a01b039182166004820152602481018390529089169063095ea7b390604401602060405180830381600087803b1580156117d857600080fd5b505af11580156117ec573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061181091906133d5565b5060006118256067546001600160a01b031690565b6001600160a01b0316638803dbee88848730426040518663ffffffff1660e01b815260040161185895949392919061377c565b600060405180830381600087803b15801561187257600080fd5b505af1158015611886573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526118ae91908101906133a2565b905081816000815181106118d257634e487b7160e01b600052603260045260246000fd5b602002602001015110156119685760675460405163095ea7b360e01b81526001600160a01b03918216600482015260006024820152908a169063095ea7b390604401602060405180830381600087803b15801561192e57600080fd5b505af1158015611942573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061196691906133d5565b505b336000908152606b602090815260408083206001600160a01b038c1684529091528120805489929061199b90849061380d565b9091555050505050505050505050565b6119b3612b5f565b606560006066836040516119c79190613585565b90815260200160405180910390206000815481106119f557634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528201929092526040018120611a2291612f0e565b606681604051611a329190613585565b908152602001604051809103902060006114789190612f0e565b6060806000611a5c868686610b5f565b9050611a68858261147b565b9093509150611a77838361078b565b50935093915050565b606080611a8e8585856116e7565b611a98848461147b565b9092509050611aa7828261078b565b935093915050565b6000611aba82612097565b92915050565b600061a4ec461415611ae45760405162461bcd60e51b815260040161068190613688565b82611aee81612097565b611b0a5760405162461bcd60e51b81526004016106819061370d565b60006066604051611b279065574d4154494360d01b815260060190565b9081526020016040518091039020600081548110611b5557634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b03169150611b76828787612a29565b9150508060018251611b889190613825565b8151811061074057634e487b7160e01b600052603260045260246000fd5b611bae612b5f565b806065600083600081518110611bd457634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000209080519060200190611c0f929190612f2c565b5080606683604051611c219190613585565b90815260200160405180910390209080519060200190611c42929190612f2c565b50606980546001810182556000919091528251611c86917f7fb4302e8e91f9110a6554c2c0a24601252c2a42c2220ca988efcfe39991430801906020850190612f91565b505050565b611c93612b5f565b606880546001810182556000919091527fa2153420d844928b4421650203c77babc8b33d7f2e7b450e2966db0c220977530180546001600160a01b0319166001600160a01b0392909216919091179055565b606a8281548110611cf557600080fd5b90600052602060002001818154811061076f57600080fd5b606080610b3f8484610d0a565b600061a4ec461415611d3e5760405162461bcd60e51b815260040161068190613688565b81611d4881612097565b611d645760405162461bcd60e51b81526004016106819061370d565b60405165574d4154494360d01b815234906000906066906006019081526020016040518091039020600081548110611dac57634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b03169150611dcc82876122e8565b80519091506000611de56067546001600160a01b031690565b6001600160a01b0316637ff36ab58660008630426040518663ffffffff1660e01b8152600401611e189493929190613620565b6000604051808303818588803b158015611e3157600080fd5b505af1158015611e45573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052611e6e91908101906133a2565b905080611e7c600184613825565b81518110611e9a57634e487b7160e01b600052603260045260246000fd5b602090810291909101810151336000908152606b835260408082206001600160a01b038d168352909352918220805491995089929091611edb90849061380d565b909155509698975050505050505050565b60608061a4ec461415611f115760405162461bcd60e51b815260040161068190613688565b6000611f1c84611d1a565b9050611f28848261147b565b9093509150611f37838361078b565b50915091565b611f45612b5f565b6001600160a01b038116611faa5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610681565b61147881612bb9565b336000908152606b602090815260408083206001600160a01b038616845290915290205481111561201d5760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b6044820152606401610681565b6120316001600160a01b0383163383612c7f565b336000908152606b602090815260408083206001600160a01b038616845290915281208054839290612064908490613825565b90915550505050565b6068818154811061207d57600080fd5b6000918252602090912001546001600160a01b0316905081565b6000805b60685481101561210657826001600160a01b0316606882815481106120d057634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156120f45750600192915050565b806120fe816138a3565b91505061209b565b50600092915050565b60608061211c85856122e8565b80519092506121336067546001600160a01b031690565b6001600160a01b0316631f00ca7485856040518363ffffffff1660e01b8152600401612160929190613763565b60006040518083038186803b15801561217857600080fd5b505afa15801561218c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526121b491908101906133a2565b9150815181146121d65760405162461bcd60e51b81526004016106819061373b565b816121e2600183613825565b8151811061220057634e487b7160e01b600052603260045260246000fd5b60200260200101518414611a775760405162461bcd60e51b815260206004820152601660248201527509eeae8e0eae840c2dadeeadce840dad2e6dac2e8c6d60531b6044820152606401610681565b6000805b606a5481101561210657826001600160a01b0316606a828154811061228857634e487b7160e01b600052603260045260246000fd5b906000526020600020016000815481106122b257634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156122d65750600192915050565b806122e0816138a3565b915050612253565b6001600160a01b03821660009081526065602052604090205460609060018114156123b7576040805160028082526060820183529091602083019080368337019050509150838260008151811061234f57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050828260018151811061239157634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505050611aba565b80600214156124d057604080516003808252608082019092529060208201606080368337019050509150838260008151811061240357634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600190811061244f57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260018151811061248e57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050828260028151811061239157634e487b7160e01b600052603260045260246000fd5b806003141561267457604080516003808252608082019092529060208201606080368337019050509150838260008151811061251c57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600190811061256857634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826001815181106125a757634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092018101919091529085166000908152606590915260409020805460029081106125f357634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260028151811061263257634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050828260038151811061239157634e487b7160e01b600052603260045260246000fd5b60408051600480825260a08201909252906020820160808036833701905050915083826000815181106126b757634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600190811061270357634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260018151811061274257634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600290811061278e57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826002815181106127cd57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600390811061281957634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260038151811061285857634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050828260048151811061239157634e487b7160e01b600052603260045260246000fd5b6040516001600160a01b0380851660248301528316604482015260648101829052610a779085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612caf565b80158061298e5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561295457600080fd5b505afa158015612968573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061298c91906134da565b155b6129f95760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610681565b6040516001600160a01b038316602482015260448101829052611c8690849063095ea7b360e01b906064016128ce565b606080612a3685856122e8565b8051909250612a4d6067546001600160a01b031690565b6001600160a01b031663d06ca61f85856040518363ffffffff1660e01b8152600401612a7a929190613763565b60006040518083038186803b158015612a9257600080fd5b505afa158015612aa6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612ace91908101906133a2565b915081518114612af05760405162461bcd60e51b81526004016106819061373b565b81600081518110612b1157634e487b7160e01b600052603260045260246000fd5b60200260200101518414611a775760405162461bcd60e51b8152602060048201526015602482015274092dce0eae840c2dadeeadce840dad2e6dac2e8c6d605b1b6044820152606401610681565b6033546001600160a01b0316331461133d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610681565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16612c765760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610681565b61133d33612bb9565b6040516001600160a01b038316602482015260448101829052611c8690849063a9059cbb60e01b906064016128ce565b6000612d04826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612d819092919063ffffffff16565b805190915015611c865780806020019051810190612d2291906133d5565b611c865760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610681565b6060612d908484600085612d98565b949350505050565b606082471015612df95760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610681565b600080866001600160a01b03168587604051612e159190613585565b60006040518083038185875af1925050503d8060008114612e52576040519150601f19603f3d011682016040523d82523d6000602084013e612e57565b606091505b5091509150612e6887838387612e73565b979650505050505050565b60608315612edf578251612ed8576001600160a01b0385163b612ed85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610681565b5081612d90565b612d908383815115612ef45781518083602001fd5b8060405162461bcd60e51b81526004016106819190613655565b50805460008255906000526020600020908101906114789190613005565b828054828255906000526020600020908101928215612f81579160200282015b82811115612f8157825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190612f4c565b50612f8d929150613005565b5090565b828054612f9d90613868565b90600052602060002090601f016020900481019282612fbf5760008555612f81565b82601f10612fd857805160ff1916838001178555612f81565b82800160010185558215612f81579182015b82811115612f81578251825591602001919060010190612fea565b5b80821115612f8d5760008155600101613006565b600082601f83011261302a578081fd5b8135602061303f61303a836137e9565b6137b8565b80838252828201915082860187848660051b890101111561305e578586fd5b855b85811015613085578135613073816138ea565b84529284019290840190600101613060565b5090979650505050505050565b600082601f8301126130a2578081fd5b815160206130b261303a836137e9565b80838252828201915082860187848660051b89010111156130d1578586fd5b855b85811015613085578151845292840192908401906001016130d3565b600082601f8301126130ff578081fd5b813567ffffffffffffffff811115613119576131196138d4565b61312c601f8201601f19166020016137b8565b818152846020838601011115613140578283fd5b816020850160208301379081016020019190915292915050565b60006020828403121561316b578081fd5b8135613176816138ea565b9392505050565b6000806040838503121561318f578081fd5b823561319a816138ea565b915060208301356131aa816138ea565b809150509250929050565b6000806000606084860312156131c9578081fd5b83356131d4816138ea565b925060208401356131e4816138ea565b929592945050506040919091013590565b60008060408385031215613207578182fd5b8235613212816138ea565b946020939093013593505050565b60008060408385031215613232578182fd5b823567ffffffffffffffff80821115613249578384fd5b6132558683870161301a565b935060209150818501358181111561326b578384fd5b85019050601f8101861361327d578283fd5b803561328b61303a826137e9565b80828252848201915084840189868560051b87010111156132aa578687fd5b8694505b838510156132cc5780358352600194909401939185019185016132ae565b5080955050505050509250929050565b600080604083850312156132ee578182fd5b825167ffffffffffffffff80821115613305578384fd5b818501915085601f830112613318578384fd5b8151602061332861303a836137e9565b8083825282820191508286018a848660051b8901011115613347578889fd5b8896505b8487101561337257805161335e816138ea565b83526001969096019591830191830161334b565b509188015191965090935050508082111561338b578283fd5b5061339885828601613092565b9150509250929050565b6000602082840312156133b3578081fd5b815167ffffffffffffffff8111156133c9578182fd5b612d9084828501613092565b6000602082840312156133e6578081fd5b81518015158114613176578182fd5b600060208284031215613406578081fd5b813567ffffffffffffffff81111561341c578182fd5b612d90848285016130ef565b6000806040838503121561343a578182fd5b823567ffffffffffffffff80821115613451578384fd5b61345d868387016130ef565b93506020850135915080821115613472578283fd5b506133988582860161301a565b60008060408385031215613491578182fd5b823567ffffffffffffffff8111156134a7578283fd5b6134b3858286016130ef565b95602094909401359450505050565b6000602082840312156134d3578081fd5b5035919050565b6000602082840312156134eb578081fd5b5051919050565b60008060408385031215613504578182fd5b50508035926020909101359150565b6000815180845260208085019450808401835b8381101561354b5781516001600160a01b031687529582019590820190600101613526565b509495945050505050565b6000815180845260208085019450808401835b8381101561354b57815187529582019590820190600101613569565b6000825161359781846020870161383c565b9190910192915050565b6001600160a01b038581168252841660208201526080604082018190526000906135cd90830185613513565b8281036060840152612e688185613556565b6020815260006131766020830184613513565b6040815260006136056040830185613513565b82810360208401526136178185613556565b95945050505050565b8481526080602082015260006136396080830186613513565b6001600160a01b03949094166040830152506060015292915050565b602081526000825180602084015261367481604085016020870161383c565b601f01601f19169190910160400192915050565b6020808252602e908201527f5468652066756e6374696f6e206973206e6f7420617661696c61626c65206f6e60408201526d103a3434b9903732ba3bb7b9359760911b606082015260800190565b60208082526018908201527f5061746820646f65736e277420796574206578697374732e0000000000000000604082015260600190565b602080825260149082015273546f6b656e206e6f742072656465656d61626c6560601b604082015260600190565b6020808252600e908201526d105c9c985e5cc81d5b995c5d585b60921b604082015260600190565b828152604060208201526000612d906040830184613513565b85815284602082015260a06040820152600061379b60a0830186613513565b6001600160a01b0394909416606083015250608001529392505050565b604051601f8201601f1916810167ffffffffffffffff811182821017156137e1576137e16138d4565b604052919050565b600067ffffffffffffffff821115613803576138036138d4565b5060051b60200190565b60008219821115613820576138206138be565b500190565b600082821015613837576138376138be565b500390565b60005b8381101561385757818101518382015260200161383f565b83811115610a775750506000910152565b600181811c9082168061387c57607f821691505b6020821081141561389d57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156138b7576138b76138be565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461147857600080fdfea26469706673582212200f2bb74b64168c68a4845864d66a79cf1c4ab79c19c33d5a3cd70163e4a3de7564736f6c63430008040033", + "numDeployments": 5, + "solcInputHash": "75278ec65526f1e0033cc879f57dc68d", + "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_poolAddresses\",\"type\":\"address[]\"},{\"internalType\":\"string[]\",\"name\":\"_tokenSymbolsForPaths\",\"type\":\"string[]\"},{\"internalType\":\"address[][]\",\"name\":\"_paths\",\"type\":\"address[][]\"},{\"internalType\":\"address\",\"name\":\"_dexRouterAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"poolToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"Redeemed\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_tokenSymbol\",\"type\":\"string\"},{\"internalType\":\"address[]\",\"name\":\"_path\",\"type\":\"address[]\"}],\"name\":\"addPath\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"addPoolToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"autoOffsetExactInETH\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountToSwap\",\"type\":\"uint256\"}],\"name\":\"autoOffsetExactInToken\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountToOffset\",\"type\":\"uint256\"}],\"name\":\"autoOffsetExactOutETH\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountToOffset\",\"type\":\"uint256\"}],\"name\":\"autoOffsetExactOutToken\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountToOffset\",\"type\":\"uint256\"}],\"name\":\"autoOffsetPoolToken\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"autoRedeem\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_amounts\",\"type\":\"uint256[]\"}],\"name\":\"autoRetire\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fromTokenAmount\",\"type\":\"uint256\"}],\"name\":\"calculateExpectedPoolTokenForETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fromAmount\",\"type\":\"uint256\"}],\"name\":\"calculateExpectedPoolTokenForToken\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAmount\",\"type\":\"uint256\"}],\"name\":\"calculateNeededETHAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAmount\",\"type\":\"uint256\"}],\"name\":\"calculateNeededTokenAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"dexRouterAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"eligibleSwapPaths\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"eligibleSwapPathsBySymbol\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_erc20Address\",\"type\":\"address\"}],\"name\":\"isERC20AddressEligible\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_path\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"isPoolAddressEligible\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_isEligible\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"paths\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"poolAddresses\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_tokenSymbol\",\"type\":\"string\"}],\"name\":\"removePath\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"removePoolToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"swapExactInETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fromAmount\",\"type\":\"uint256\"}],\"name\":\"swapExactInToken\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAmount\",\"type\":\"uint256\"}],\"name\":\"swapExactOutETH\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAmount\",\"type\":\"uint256\"}],\"name\":\"swapExactOutToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"tokenSymbolsForPaths\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"events\":{\"Redeemed(address,address,address[],uint256[])\":{\"params\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"poolToken\":\"The address of the pool token used in the redemption, e.g., NCT\",\"sender\":\"The sender of the transaction\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}}},\"kind\":\"dev\",\"methods\":{\"addPath(string,address[])\":{\"params\":{\"_path\":\"The path of the path to add\",\"_tokenSymbol\":\"The symbol of the token to add\"}},\"addPoolToken(address)\":{\"params\":{\"_poolToken\":\"The address of the pool token to add\"}},\"autoOffsetExactInETH(address)\":{\"details\":\"This function is only available on Polygon, not on Celo.\",\"params\":{\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoOffsetExactInToken(address,address,uint256)\":{\"details\":\"When automatically redeeming pool tokens for the oldest ones TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool token.\",\"params\":{\"_amountToSwap\":\"The amount of ERC20 token to swap into Toucan pool token. Full amount will be used for offsetting.\",\"_fromToken\":\"The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\",\"_poolToken\":\"The address of the pool token that the user wants to use, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoOffsetExactOutETH(address,uint256)\":{\"details\":\"If the user sends too much native tokens , the leftover amount will be sent back to the user. This function is only available on Polygon, not on Celo.\",\"params\":{\"_amountToOffset\":\"The amount of TCO2 to offset.\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoOffsetExactOutToken(address,address,uint256)\":{\"details\":\"When automatically redeeming pool tokens for the oldest ones TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool token.\",\"params\":{\"_amountToOffset\":\"The amount of TCO2 to offset\",\"_fromToken\":\"The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\",\"_poolToken\":\"The address of the pool token that the user wants to use, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoOffsetPoolToken(address,uint256)\":{\"params\":{\"_amountToOffset\":\"The amount of TCO2 to offset.\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoRedeem(address,uint256)\":{\"details\":\"Needs to be approved on the client side\",\"params\":{\"_amount\":\"Amount to redeem\",\"_fromToken\":\"Could be the address of NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoRetire(address[],uint256[])\":{\"params\":{\"_amounts\":\"The amounts to retire from each of the corresponding TCO2 addresses\",\"_tco2s\":\"The addresses of the TCO2s to retire\"}},\"calculateExpectedPoolTokenForETH(address,uint256)\":{\"params\":{\"_fromTokenAmount\":\"The amount of native tokens to swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amountOut\":\"The expected amount of Pool token that can be acquired\"}},\"calculateExpectedPoolTokenForToken(address,address,uint256)\":{\"params\":{\"_fromAmount\":\"The amount of ERC20 token to swap\",\"_fromToken\":\"The address of the ERC20 token used for the swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amountOut\":\"The expected amount of Pool token that can be acquired\"}},\"calculateNeededETHAmount(address,uint256)\":{\"params\":{\"_poolToken\":\"The address of the pool token to swap for, for example, NCT\",\"_toAmount\":\"The desired amount of pool token to receive\"},\"returns\":{\"amountIn\":\"The amount of native tokens required in order to swap for the specified amount of the pool token\"}},\"calculateNeededTokenAmount(address,address,uint256)\":{\"params\":{\"_fromToken\":\"The address of the ERC20 token used for the swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\",\"_toAmount\":\"The desired amount of pool token to receive\"},\"returns\":{\"amountIn\":\"The amount of the ERC20 token required in order to swap for the specified amount of the pool token\"}},\"constructor\":{\"details\":\"See `isEligible()` for a list of tokens that can be used in the contract. These can be modified after deployment by the contract owner using `setEligibleTokenAddress()` and `deleteEligibleTokenAddress()`.\",\"params\":{\"_paths\":\"An array of arrays of addresses to describe the path needed to swap form the baseToken to the pool Token to the provided token symbols.\",\"_poolAddresses\":\"A list of pool token addresses.\",\"_tokenSymbolsForPaths\":\"An array of symbols of the token the user want to retire carbon credits for\"}},\"isERC20AddressEligible(address)\":{\"params\":{\"_erc20Address\":\"The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\"},\"returns\":{\"_path\":\"Returns the path of the token to be exchanged\"}},\"isPoolAddressEligible(address)\":{\"params\":{\"_poolToken\":\"The addresses of the pool token to redeem\"},\"returns\":{\"_isEligible\":\"Returns if token can be redeemed\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"removePath(string)\":{\"params\":{\"_tokenSymbol\":\"The symbol of the path to remove\"}},\"removePoolToken(address)\":{\"params\":{\"_poolToken\":\"The address of the pool token to remove\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"swapExactInETH(address)\":{\"params\":{\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amountOut\":\"Resulting amount of pool token that got acquired for the swapped native tokens .\"}},\"swapExactInToken(address,address,uint256)\":{\"details\":\"Needs to be approved on the client side.\",\"params\":{\"_fromAmount\":\"The amount of ERC20 token to swap e.g., NCT\",\"_fromToken\":\"The address of the ERC20 token used for the swap\",\"_poolToken\":\"The address of the pool token to swap for,\"},\"returns\":{\"amountOut\":\"Resulting amount of pool token that got acquired for the swapped ERC20 tokens.\"}},\"swapExactOutETH(address,uint256)\":{\"params\":{\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\",\"_toAmount\":\"The required amount of the pool token (NCT/BCT)\"}},\"swapExactOutToken(address,address,uint256)\":{\"details\":\"Needs to be approved on the client side\",\"params\":{\"_fromToken\":\"The address of the ERC20 token used for the swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\",\"_toAmount\":\"The required amount of the pool token (NCT/BCT)\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"title\":\"Toucan Protocol Offset Helpers\",\"version\":1},\"userdoc\":{\"events\":{\"Redeemed(address,address,address[],uint256[])\":{\"notice\":\"Emitted upon successful redemption of TCO2 tokens from a Toucan pool token e.g., NCT.\"}},\"kind\":\"user\",\"methods\":{\"addPath(string,address[])\":{\"notice\":\"Change or add eligible paths and their addresses.\"},\"addPoolToken(address)\":{\"notice\":\"Change or add pool token addresses.\"},\"autoOffsetExactInETH(address)\":{\"notice\":\"Retire carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC. All provided native tokens is consumed for offsetting. Use `calculateExpectedPoolTokenForETH()` to calculate the expected amount of Pool token that can be acquired by swapping the provided amount of native tokens e.g., MATIC. This function: 1. Swaps the Matic sent to the contract for the specified pool token. 2. Redeems the pool token for the oldest TCO2 tokens available. 3. Retires the TCO2 tokens.\"},\"autoOffsetExactInToken(address,address,uint256)\":{\"notice\":\"Retire carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending ERC20 tokens (cUSD, USDC, WETH, WMATIC). All provided token is consumed for offsetting. Use `calculateExpectedPoolTokenForToken()` to calculate the expected amount of Pool token that can be acquired by swapping the provided amount of ERC20 token. This function: 1. Swaps the ERC20 token sent to the contract for the specified pool token. 2. Redeems the pool token for the oldest TCO2 tokens available. 3. Retires the TCO2 tokens. Note: The client must approve the ERC20 token that is sent to the contract.\"},\"autoOffsetExactOutETH(address,uint256)\":{\"notice\":\"Retire carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC. Use `calculateNeededETHAmount()` first in order to find out how much native tokens are required to retire the specified quantity of TCO2. This function: 1. Swaps the Matic sent to the contract for the specified pool token. 2. Redeems the pool token for the oldest TCO2 tokens available. 3. Retires the TCO2 tokens.\"},\"autoOffsetExactOutToken(address,address,uint256)\":{\"notice\":\"Retire carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending ERC20 tokens (cUSD, USDC, WETH, WMATIC). Use `calculateNeededTokenAmount` first in order to find out how much of the ERC20 token is required to retire the specified quantity of TCO2. This function: 1. Swaps the ERC20 token sent to the contract for the specified pool token. 2. Redeems the pool token for the oldest TCO2 tokens available. 3. Retires the TCO2 tokens. Note: The client must approve the ERC20 token that is sent to the contract.\"},\"autoOffsetPoolToken(address,uint256)\":{\"notice\":\"Retire carbon credits using the oldest TCO2 tokens available by sending pool tokens, e.g., NCT. This function: 1. Redeems the pool token for the oldest TCO2 tokens available. 2. Retires the TCO2 tokens. Note: The client must approve the pool token that is sent.\"},\"autoRedeem(address,uint256)\":{\"notice\":\"Redeems the specified amount of NCT / BCT for TCO2.\"},\"autoRetire(address[],uint256[])\":{\"notice\":\"Retire the specified TCO2 tokens.\"},\"calculateExpectedPoolTokenForETH(address,uint256)\":{\"notice\":\"Calculates the expected amount of pool token that can be acquired by swapping the provided amount of native tokens e.g., MATIC.\"},\"calculateExpectedPoolTokenForToken(address,address,uint256)\":{\"notice\":\"Calculates the expected amount of pool token that can be acquired by swapping the provided amount of ERC20 token.\"},\"calculateNeededETHAmount(address,uint256)\":{\"notice\":\"Return how much native tokens e.g, MATIC is required in order to swap for the desired amount of a pool token, e.g., NCT.\"},\"calculateNeededTokenAmount(address,address,uint256)\":{\"notice\":\"Return how much of the specified ERC20 token is required in order to swap for the desired amount of a pool token, for example, e.g., NCT.\"},\"constructor\":{\"notice\":\"Contract constructor. Should specify arrays of ERC20 symbols and addresses that can used by the contract.\"},\"isERC20AddressEligible(address)\":{\"notice\":\"Checks if ERC20 Token is eligible for Offsetting.\"},\"isPoolAddressEligible(address)\":{\"notice\":\"Cheks if Pool Token is eligible for Offsetting.\"},\"removePath(string)\":{\"notice\":\"Delete eligible tokens stored in the contract.\"},\"removePoolToken(address)\":{\"notice\":\"Delete eligible pool token addresses stored in the contract.\"},\"swapExactInETH(address)\":{\"notice\":\"Swap native tokens e.g., MATIC for pool tokens (BCT/NCT) on SushiSwap. All provided native tokens will be swapped.\"},\"swapExactInToken(address,address,uint256)\":{\"notice\":\"Swap eligible ERC20 tokens for pool tokens (BCT/NCT) on SushiSwap. All provided ERC20 tokens will be swapped.\"},\"swapExactOutETH(address,uint256)\":{\"notice\":\"Swap native tokens e.g., MATIC for pool tokens (BCT/NCT) on SushiSwap. Remaining native tokens that was not consumed by the swap is returned.\"},\"swapExactOutToken(address,address,uint256)\":{\"notice\":\"Swap eligible ERC20 tokens for pool tokens (BCT/NCT) on SushiSwap\"}},\"notice\":\"Helper functions that simplify the carbon offsetting (retirement) process. Retiring carbon tokens requires multiple steps and interactions with Toucan Protocol's main contracts: 1. Obtain a pool token e.g., NCT (by performing a token swap on a DEX). 2. Redeem the pool token for a TCO2 token. 3. Retire the TCO2 token. These steps are combined in each of the following \\\"auto offset\\\" methods implemented in `OffsetHelper` to allow a retirement within one transaction: - `autoOffsetPoolToken()` if the user already owns a Toucan pool token e.g., NCT, - `autoOffsetExactOutETH()` if the user would like to perform a retirement using native tokens e.g., MATIC, specifying the exact amount of TCO2s to retire (only on Polygon, not on Celo), - `autoOffsetExactInETH()` if the user would like to perform a retirement using native tokens, swapping all sent native tokens into TCO2s (only on Polygon, not on Celo), - `autoOffsetExactOutToken()` if the user would like to perform a retirement using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount of TCO2s to retire, - `autoOffsetExactInToken()` if the user would like to perform a retirement using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount of token to swap into TCO2s. In these methods, \\\"auto\\\" refers to the fact that these methods use `autoRedeem()` in order to automatically choose a TCO2 token corresponding to the oldest tokenized carbon project in the specfified token pool. There are no fees incurred by the user when using `autoRedeem()`, i.e., the user receives 1 TCO2 token for each pool token (BCT/NCT) redeemed. There are two `view` helper functions `calculateNeededETHAmount()` and `calculateNeededTokenAmount()` that should be called before using `autoOffsetExactOutETH()` and `autoOffsetExactOutToken()`, to determine how much native tokens e.g., MATIC, respectively how much of the ERC20 token must be sent to the `OffsetHelper` contract in order to retire the specified amount of carbon. The two `view` helper functions `calculateExpectedPoolTokenForETH()` and `calculateExpectedPoolTokenForToken()` can be used to calculate the expected amount of TCO2s that will be offset using functions `autoOffsetExactInETH()` and `autoOffsetExactInToken()`.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/OffsetHelper.sol\":\"OffsetHelper\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20Upgradeable {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x4e733d3164f73f461eaf9d8087a7ad1ea180bdc8ba0d3d61b0e1ae16d8e63dff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n function safePermit(\\n IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9b72f93be69ca894d8492c244259615c4a742afc8d63720dbc8bb81087d9b238\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721Receiver {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol\":{\"content\":\"pragma solidity >=0.6.2;\\n\\ninterface IUniswapV2Router01 {\\n function factory() external pure returns (address);\\n function WETH() external pure returns (address);\\n\\n function addLiquidity(\\n address tokenA,\\n address tokenB,\\n uint amountADesired,\\n uint amountBDesired,\\n uint amountAMin,\\n uint amountBMin,\\n address to,\\n uint deadline\\n ) external returns (uint amountA, uint amountB, uint liquidity);\\n function addLiquidityETH(\\n address token,\\n uint amountTokenDesired,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline\\n ) external payable returns (uint amountToken, uint amountETH, uint liquidity);\\n function removeLiquidity(\\n address tokenA,\\n address tokenB,\\n uint liquidity,\\n uint amountAMin,\\n uint amountBMin,\\n address to,\\n uint deadline\\n ) external returns (uint amountA, uint amountB);\\n function removeLiquidityETH(\\n address token,\\n uint liquidity,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline\\n ) external returns (uint amountToken, uint amountETH);\\n function removeLiquidityWithPermit(\\n address tokenA,\\n address tokenB,\\n uint liquidity,\\n uint amountAMin,\\n uint amountBMin,\\n address to,\\n uint deadline,\\n bool approveMax, uint8 v, bytes32 r, bytes32 s\\n ) external returns (uint amountA, uint amountB);\\n function removeLiquidityETHWithPermit(\\n address token,\\n uint liquidity,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline,\\n bool approveMax, uint8 v, bytes32 r, bytes32 s\\n ) external returns (uint amountToken, uint amountETH);\\n function swapExactTokensForTokens(\\n uint amountIn,\\n uint amountOutMin,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external returns (uint[] memory amounts);\\n function swapTokensForExactTokens(\\n uint amountOut,\\n uint amountInMax,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external returns (uint[] memory amounts);\\n function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)\\n external\\n payable\\n returns (uint[] memory amounts);\\n function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)\\n external\\n returns (uint[] memory amounts);\\n function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)\\n external\\n returns (uint[] memory amounts);\\n function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)\\n external\\n payable\\n returns (uint[] memory amounts);\\n\\n function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);\\n function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);\\n function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);\\n function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);\\n function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);\\n}\\n\",\"keccak256\":\"0x8a3c5c449d4b7cd76513ed6995f4b86e4a86f222c770f8442f5fc128ce29b4d2\"},\"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\":{\"content\":\"pragma solidity >=0.6.2;\\n\\nimport './IUniswapV2Router01.sol';\\n\\ninterface IUniswapV2Router02 is IUniswapV2Router01 {\\n function removeLiquidityETHSupportingFeeOnTransferTokens(\\n address token,\\n uint liquidity,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline\\n ) external returns (uint amountETH);\\n function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(\\n address token,\\n uint liquidity,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline,\\n bool approveMax, uint8 v, bytes32 r, bytes32 s\\n ) external returns (uint amountETH);\\n\\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\\n uint amountIn,\\n uint amountOutMin,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external;\\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\\n uint amountOutMin,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external payable;\\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\\n uint amountIn,\\n uint amountOutMin,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external;\\n}\\n\",\"keccak256\":\"0x744e30c133bd0f7ca9e7163433cf6d72f45c6bb1508c2c9c02f1a6db796ae59d\"},\"contracts/OffsetHelper.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2022 Toucan Labs\\n// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\\\";\\nimport \\\"./OffsetHelperStorage.sol\\\";\\nimport \\\"./interfaces/IToucanPoolToken.sol\\\";\\nimport \\\"./interfaces/IToucanCarbonOffsets.sol\\\";\\nimport \\\"./interfaces/IToucanContractRegistry.sol\\\";\\n\\n/**\\n * @title Toucan Protocol Offset Helpers\\n * @notice Helper functions that simplify the carbon offsetting (retirement)\\n * process.\\n *\\n * Retiring carbon tokens requires multiple steps and interactions with\\n * Toucan Protocol's main contracts:\\n * 1. Obtain a pool token e.g., NCT (by performing a token\\n * swap on a DEX).\\n * 2. Redeem the pool token for a TCO2 token.\\n * 3. Retire the TCO2 token.\\n *\\n * These steps are combined in each of the following \\\"auto offset\\\" methods\\n * implemented in `OffsetHelper` to allow a retirement within one transaction:\\n * - `autoOffsetPoolToken()` if the user already owns a Toucan pool\\n * token e.g., NCT,\\n * - `autoOffsetExactOutETH()` if the user would like to perform a retirement\\n * using native tokens e.g., MATIC, specifying the exact amount of TCO2s to retire (only on Polygon, not on Celo),\\n * - `autoOffsetExactInETH()` if the user would like to perform a retirement\\n * using native tokens, swapping all sent native tokens into TCO2s (only on Polygon, not on Celo),\\n * - `autoOffsetExactOutToken()` if the user would like to perform a retirement\\n * using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount\\n * of TCO2s to retire,\\n * - `autoOffsetExactInToken()` if the user would like to perform a retirement\\n * using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount\\n * of token to swap into TCO2s.\\n *\\n * In these methods, \\\"auto\\\" refers to the fact that these methods use\\n * `autoRedeem()` in order to automatically choose a TCO2 token corresponding\\n * to the oldest tokenized carbon project in the specfified token pool.\\n * There are no fees incurred by the user when using `autoRedeem()`, i.e., the\\n * user receives 1 TCO2 token for each pool token (BCT/NCT) redeemed.\\n *\\n * There are two `view` helper functions `calculateNeededETHAmount()` and\\n * `calculateNeededTokenAmount()` that should be called before using\\n * `autoOffsetExactOutETH()` and `autoOffsetExactOutToken()`, to determine how\\n * much native tokens e.g., MATIC, respectively how much of the ERC20 token must be sent to the\\n * `OffsetHelper` contract in order to retire the specified amount of carbon.\\n *\\n * The two `view` helper functions `calculateExpectedPoolTokenForETH()` and\\n * `calculateExpectedPoolTokenForToken()` can be used to calculate the\\n * expected amount of TCO2s that will be offset using functions\\n * `autoOffsetExactInETH()` and `autoOffsetExactInToken()`.\\n */\\ncontract OffsetHelper is OffsetHelperStorage {\\n using SafeERC20 for IERC20;\\n // As Celo allows to pay the gas fees with other tokens than the native token,\\n // it's not possible ot use the swapETH (swap native tokens) functions.\\n uint256 private constant CELO_MAINNET_CHAINID = 42220;\\n uint256 private constant ALFAJORES_MAINNET_CHAINID = 44787;\\n\\n /**\\n * @notice Emitted upon successful redemption of TCO2 tokens from a Toucan\\n * pool token e.g., NCT.\\n *\\n * @param sender The sender of the transaction\\n * @param poolToken The address of the pool token used in the\\n * redemption, e.g., NCT\\n * @param tco2s An array of the TCO2 addresses that were redeemed\\n * @param amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n event Redeemed(\\n address sender,\\n address poolToken,\\n address[] tco2s,\\n uint256[] amounts\\n );\\n\\n modifier onlyRedeemable(address _token) {\\n require(isRedeemable(_token), \\\"Token not redeemable.\\\");\\n\\n _;\\n }\\n\\n modifier onlySwappable(address _token) {\\n require(isSwappable(_token), \\\"Path doesn't yet exist.\\\");\\n\\n _;\\n }\\n\\n modifier isNotCelo() {\\n require(\\n block.chainid != CELO_MAINNET_CHAINID &&\\n block.chainid != ALFAJORES_MAINNET_CHAINID,\\n \\\"The function is not available on Celo.\\\"\\n );\\n\\n _;\\n }\\n\\n /**\\n * @notice Contract constructor. Should specify arrays of ERC20 symbols and\\n * addresses that can used by the contract.\\n *\\n * @dev See `isEligible()` for a list of tokens that can be used in the\\n * contract. These can be modified after deployment by the contract owner\\n * using `setEligibleTokenAddress()` and `deleteEligibleTokenAddress()`.\\n *\\n * @param _poolAddresses A list of pool token addresses.\\n * @param _tokenSymbolsForPaths An array of symbols of the token the user want to retire carbon credits for\\n * @param _paths An array of arrays of addresses to describe the path needed to swap form the baseToken to the pool Token\\n * to the provided token symbols.\\n */\\n constructor(\\n address[] memory _poolAddresses,\\n string[] memory _tokenSymbolsForPaths,\\n address[][] memory _paths,\\n address _dexRouterAddress\\n ) {\\n poolAddresses = _poolAddresses;\\n tokenSymbolsForPaths = _tokenSymbolsForPaths;\\n paths = _paths;\\n dexRouterAddress = _dexRouterAddress;\\n\\n uint256 eligibleSwapPathsBySymbolLen = _tokenSymbolsForPaths.length;\\n for (uint256 i; i < eligibleSwapPathsBySymbolLen; i++) {\\n eligibleSwapPaths[_paths[i][0]] = _paths[i];\\n eligibleSwapPathsBySymbol[_tokenSymbolsForPaths[i]] = _paths[i];\\n }\\n }\\n\\n // The receive and fallback method are needed to fix the situation where transfering dust native tokens\\n // in the native tokens to token swap fails\\n receive() external payable {}\\n\\n // ----------------------------------------\\n // Public functions\\n // ----------------------------------------\\n\\n /**\\n * @notice Retire carbon credits using the oldest TCO2\\n * tokens available from the specified Toucan token pool by sending ERC20\\n * tokens (cUSD, USDC, WETH, WMATIC). Use `calculateNeededTokenAmount` first in\\n * order to find out how much of the ERC20 token is required to retire the\\n * specified quantity of TCO2.\\n *\\n * This function:\\n * 1. Swaps the ERC20 token sent to the contract for the specified pool token.\\n * 2. Redeems the pool token for the oldest TCO2 tokens available.\\n * 3. Retires the TCO2 tokens.\\n *\\n * Note: The client must approve the ERC20 token that is sent to the contract.\\n *\\n * @dev When automatically redeeming pool tokens for the oldest ones\\n * TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool\\n * token.\\n *\\n * @param _fromToken The address of the ERC20 token that the user sends\\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\\n * @param _poolToken The address of the pool token that the\\n * user wants to use, e.g., NCT\\n * @param _amountToOffset The amount of TCO2 to offset\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetExactOutToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _amountToOffset\\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\\n // swap input token for BCT / NCT\\n swapExactOutToken(_fromToken, _poolToken, _amountToOffset);\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire carbon credits using the oldest TCO2\\n * tokens available from the specified Toucan token pool by sending ERC20\\n * tokens (cUSD, USDC, WETH, WMATIC). All provided token is consumed for\\n * offsetting. Use `calculateExpectedPoolTokenForToken()` to calculate the expected amount\\n * of Pool token that can be acquired by swapping the provided amount of ERC20 token.\\n *\\n * This function:\\n * 1. Swaps the ERC20 token sent to the contract for the specified pool token.\\n * 2. Redeems the pool token for the oldest TCO2 tokens available.\\n * 3. Retires the TCO2 tokens.\\n *\\n * Note: The client must approve the ERC20 token that is sent to the contract.\\n *\\n * @dev When automatically redeeming pool tokens for the oldest ones\\n * TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool\\n * token.\\n *\\n * @param _fromToken The address of the ERC20 token that the user sends\\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\\n * @param _poolToken The address of the pool token that the\\n * user wants to use, e.g., NCT\\n * @param _amountToSwap The amount of ERC20 token to swap into Toucan pool\\n * token. Full amount will be used for offsetting.\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetExactInToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _amountToSwap\\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\\n // swap input token for BCT / NCT\\n uint256 amountToOffset = swapExactInToken(\\n _fromToken,\\n _poolToken,\\n _amountToSwap\\n );\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire carbon credits using the oldest TCO2\\n * tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC.\\n * Use `calculateNeededETHAmount()` first in order to find out how much\\n * native tokens are required to retire the specified quantity of TCO2.\\n *\\n * This function:\\n * 1. Swaps the Matic sent to the contract for the specified pool token.\\n * 2. Redeems the pool token for the oldest TCO2 tokens available.\\n * 3. Retires the TCO2 tokens.\\n *\\n * @dev If the user sends too much native tokens , the leftover amount will be sent back\\n * to the user. This function is only available on Polygon, not on Celo.\\n *\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _amountToOffset The amount of TCO2 to offset.\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetExactOutETH(\\n address _poolToken,\\n uint256 _amountToOffset\\n )\\n public\\n payable\\n isNotCelo\\n returns (address[] memory tco2s, uint256[] memory amounts)\\n {\\n // swap native tokens for BCT / NCT\\n swapExactOutETH(_poolToken, _amountToOffset);\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire carbon credits using the oldest TCO2\\n * tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC.\\n * All provided native tokens is consumed for offsetting.\\n * Use `calculateExpectedPoolTokenForETH()` to calculate the expected amount of\\n * Pool token that can be acquired by swapping the provided amount of native tokens e.g., MATIC.\\n *\\n * This function:\\n * 1. Swaps the Matic sent to the contract for the specified pool token.\\n * 2. Redeems the pool token for the oldest TCO2 tokens available.\\n * 3. Retires the TCO2 tokens.\\n *\\n * @dev This function is only available on Polygon, not on Celo.\\n *\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetExactInETH(\\n address _poolToken\\n )\\n public\\n payable\\n isNotCelo\\n returns (address[] memory tco2s, uint256[] memory amounts)\\n {\\n // swap native tokens for BCT / NCT\\n uint256 amountToOffset = swapExactInETH(_poolToken);\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire carbon credits using the oldest TCO2\\n * tokens available by sending pool tokens, e.g., NCT.\\n *\\n * This function:\\n * 1. Redeems the pool token for the oldest TCO2 tokens available.\\n * 2. Retires the TCO2 tokens.\\n *\\n * Note: The client must approve the pool token that is sent.\\n *\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _amountToOffset The amount of TCO2 to offset.\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetPoolToken(\\n address _poolToken,\\n uint256 _amountToOffset\\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\\n // deposit pool token from user to this contract\\n IERC20(_poolToken).safeTransferFrom(\\n msg.sender,\\n address(this),\\n _amountToOffset\\n );\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Redeems the specified amount of NCT / BCT for TCO2.\\n * @dev Needs to be approved on the client side\\n * @param _fromToken Could be the address of NCT\\n * @param _amount Amount to redeem\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoRedeem(\\n address _fromToken,\\n uint256 _amount\\n )\\n public\\n onlyRedeemable(_fromToken)\\n returns (address[] memory tco2s, uint256[] memory amounts)\\n {\\n require(\\n IERC20(_fromToken).balanceOf(address(this)) >= _amount,\\n \\\"Insufficient NCT/BCT balance\\\"\\n );\\n\\n // instantiate pool token (NCT)\\n IToucanPoolToken PoolTokenImplementation = IToucanPoolToken(_fromToken);\\n\\n // auto redeem pool token for TCO2; will transfer automatically picked TCO2 to this contract\\n (tco2s, amounts) = PoolTokenImplementation.redeemAuto2(_amount);\\n\\n emit Redeemed(msg.sender, _fromToken, tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire the specified TCO2 tokens.\\n * @param _tco2s The addresses of the TCO2s to retire\\n * @param _amounts The amounts to retire from each of the corresponding\\n * TCO2 addresses\\n */\\n function autoRetire(\\n address[] memory _tco2s,\\n uint256[] memory _amounts\\n ) public {\\n uint256 tco2sLen = _tco2s.length;\\n require(tco2sLen != 0, \\\"Array empty\\\");\\n\\n require(tco2sLen == _amounts.length, \\\"Arrays unequal\\\");\\n\\n for (uint i = 0; i < tco2sLen; i++) {\\n if (_amounts[i] == 0) {\\n continue;\\n }\\n require(\\n IERC20(_tco2s[i]).balanceOf(address(this)) >= _amounts[i],\\n \\\"Insufficient TCO2 balance\\\"\\n );\\n\\n IToucanCarbonOffsets(_tco2s[i]).retire(_amounts[i]);\\n }\\n }\\n\\n /**\\n * @notice Swap eligible ERC20 tokens for pool tokens (BCT/NCT) on SushiSwap\\n * @dev Needs to be approved on the client side\\n * @param _fromToken The address of the ERC20 token used for the swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _toAmount The required amount of the pool token (NCT/BCT)\\n */\\n function swapExactOutToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _toAmount\\n ) public onlySwappable(_fromToken) onlyRedeemable(_poolToken) {\\n // calculate path & amounts\\n (\\n address[] memory path,\\n uint256[] memory expAmounts\\n ) = calculateExactOutSwap(_fromToken, _poolToken, _toAmount);\\n uint256 amountIn = expAmounts[0];\\n\\n // transfer tokens\\n IERC20(_fromToken).safeTransferFrom(\\n msg.sender,\\n address(this),\\n amountIn\\n );\\n\\n // approve router\\n IERC20(_fromToken).approve(dexRouterAddress, amountIn);\\n\\n // swap\\n uint256[] memory amounts = dexRouter().swapTokensForExactTokens(\\n _toAmount,\\n amountIn, // max. input amount\\n path,\\n address(this),\\n block.timestamp\\n );\\n\\n // remove remaining approval if less input token was consumed\\n if (amounts[0] < amountIn) {\\n IERC20(_fromToken).approve(dexRouterAddress, 0);\\n }\\n }\\n\\n /**\\n * @notice Swap eligible ERC20 tokens for pool tokens (BCT/NCT) on\\n * SushiSwap. All provided ERC20 tokens will be swapped.\\n * @dev Needs to be approved on the client side.\\n * @param _fromToken The address of the ERC20 token used for the swap\\n * @param _poolToken The address of the pool token to swap for,\\n * @param _fromAmount The amount of ERC20 token to swap\\n * e.g., NCT\\n * @return amountOut Resulting amount of pool token that got acquired for the\\n * swapped ERC20 tokens.\\n */\\n function swapExactInToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _fromAmount\\n )\\n public\\n onlySwappable(_fromToken)\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountOut)\\n {\\n // calculate path & amounts\\n address[] memory path = generatePath(_fromToken, _poolToken);\\n\\n uint256 len = path.length;\\n\\n // transfer tokens\\n IERC20(_fromToken).safeTransferFrom(\\n msg.sender,\\n address(this),\\n _fromAmount\\n );\\n\\n // approve router\\n IERC20(_fromToken).safeApprove(dexRouterAddress, _fromAmount);\\n\\n // swap\\n uint256[] memory amounts = dexRouter().swapExactTokensForTokens(\\n _fromAmount,\\n 0, // min. output amount\\n path,\\n address(this),\\n block.timestamp\\n );\\n amountOut = amounts[len - 1];\\n }\\n\\n /**\\n * @notice Swap native tokens e.g., MATIC for pool tokens (BCT/NCT) on SushiSwap.\\n * Remaining native tokens that was not consumed by the swap is returned.\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _toAmount The required amount of the pool token (NCT/BCT)\\n */\\n function swapExactOutETH(\\n address _poolToken,\\n uint256 _toAmount\\n ) public payable isNotCelo onlyRedeemable(_poolToken) {\\n // create path & amounts\\n // wrap the native token\\n address fromToken = eligibleSwapPathsBySymbol[\\\"WMATIC\\\"][0];\\n address[] memory path = generatePath(fromToken, _poolToken);\\n\\n // swap\\n uint256[] memory amounts = dexRouter().swapETHForExactTokens{\\n value: msg.value\\n }(_toAmount, path, address(this), block.timestamp);\\n\\n // send surplus back\\n if (msg.value > amounts[0]) {\\n uint256 leftoverETH = msg.value - amounts[0];\\n (bool success, ) = msg.sender.call{value: leftoverETH}(\\n new bytes(0)\\n );\\n\\n require(success, \\\"Failed to send surplus back\\\");\\n }\\n }\\n\\n /**\\n * @notice Swap native tokens e.g., MATIC for pool tokens (BCT/NCT) on SushiSwap. All\\n * provided native tokens will be swapped.\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @return amountOut Resulting amount of pool token that got acquired for the\\n * swapped native tokens .\\n */\\n function swapExactInETH(\\n address _poolToken\\n )\\n public\\n payable\\n isNotCelo\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountOut)\\n {\\n // create path & amounts\\n uint256 fromAmount = msg.value;\\n // wrap the native token\\n address fromToken = eligibleSwapPathsBySymbol[\\\"WMATIC\\\"][0];\\n address[] memory path = generatePath(fromToken, _poolToken);\\n\\n uint256 len = path.length;\\n\\n // swap\\n uint256[] memory amounts = dexRouter().swapExactETHForTokens{\\n value: fromAmount\\n }(0, path, address(this), block.timestamp);\\n amountOut = amounts[len - 1];\\n }\\n\\n // ----------------------------------------\\n // Public view functions\\n // ----------------------------------------\\n\\n /**\\n * @notice Return how much of the specified ERC20 token is required in\\n * order to swap for the desired amount of a pool token, for\\n * example, e.g., NCT.\\n *\\n * @param _fromToken The address of the ERC20 token used for the swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _toAmount The desired amount of pool token to receive\\n * @return amountIn The amount of the ERC20 token required in order to\\n * swap for the specified amount of the pool token\\n */\\n function calculateNeededTokenAmount(\\n address _fromToken,\\n address _poolToken,\\n uint256 _toAmount\\n )\\n public\\n view\\n onlySwappable(_fromToken)\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountIn)\\n {\\n (, uint256[] memory amounts) = calculateExactOutSwap(\\n _fromToken,\\n _poolToken,\\n _toAmount\\n );\\n amountIn = amounts[0];\\n }\\n\\n /**\\n * @notice Return how much native tokens e.g, MATIC is required in order to swap for the\\n * desired amount of a pool token, e.g., NCT.\\n * @param _poolToken The address of the pool token to swap for, for\\n * example, NCT\\n * @param _toAmount The desired amount of pool token to receive\\n * @return amountIn The amount of native tokens required in order to swap for\\n * the specified amount of the pool token\\n */\\n function calculateNeededETHAmount(\\n address _poolToken,\\n uint256 _toAmount\\n ) public view onlyRedeemable(_poolToken) returns (uint256 amountIn) {\\n address fromToken = eligibleSwapPathsBySymbol[\\\"WMATIC\\\"][0];\\n (, uint256[] memory amounts) = calculateExactOutSwap(\\n fromToken,\\n _poolToken,\\n _toAmount\\n );\\n amountIn = amounts[0];\\n }\\n\\n /**\\n * @notice Calculates the expected amount of pool token that can be\\n * acquired by swapping the provided amount of ERC20 token.\\n *\\n * @param _fromToken The address of the ERC20 token used for the swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _fromAmount The amount of ERC20 token to swap\\n * @return amountOut The expected amount of Pool token that can be acquired\\n */\\n function calculateExpectedPoolTokenForToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _fromAmount\\n )\\n public\\n view\\n onlySwappable(_fromToken)\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountOut)\\n {\\n (, uint256[] memory amounts) = calculateExactInSwap(\\n _fromToken,\\n _poolToken,\\n _fromAmount\\n );\\n amountOut = amounts[amounts.length - 1];\\n }\\n\\n /**\\n * @notice Calculates the expected amount of pool token that can be\\n * acquired by swapping the provided amount of native tokens e.g., MATIC.\\n *\\n * @param _fromTokenAmount The amount of native tokens to swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @return amountOut The expected amount of Pool token that can be acquired\\n */\\n function calculateExpectedPoolTokenForETH(\\n address _poolToken,\\n uint256 _fromTokenAmount\\n )\\n public\\n view\\n isNotCelo\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountOut)\\n {\\n address fromToken = eligibleSwapPathsBySymbol[\\\"WMATIC\\\"][0];\\n (, uint256[] memory amounts) = calculateExactInSwap(\\n fromToken,\\n _poolToken,\\n _fromTokenAmount\\n );\\n amountOut = amounts[amounts.length - 1];\\n }\\n\\n // ----------------------------------------\\n // Internal functions\\n // ----------------------------------------\\n\\n function calculateExactOutSwap(\\n address _fromToken,\\n address _poolToken,\\n uint256 _toAmount\\n ) internal view returns (address[] memory path, uint256[] memory amounts) {\\n // create path & calculate amounts\\n path = generatePath(_fromToken, _poolToken);\\n uint256 len = path.length;\\n\\n amounts = dexRouter().getAmountsIn(_toAmount, path);\\n\\n // sanity check arrays\\n require(len == amounts.length, \\\"Arrays unequal\\\");\\n require(_toAmount == amounts[len - 1], \\\"Output amount mismatch\\\");\\n }\\n\\n function calculateExactInSwap(\\n address _fromToken,\\n address _poolToken,\\n uint256 _fromAmount\\n ) internal view returns (address[] memory path, uint256[] memory amounts) {\\n // create path & calculate amounts\\n path = generatePath(_fromToken, _poolToken);\\n uint256 len = path.length;\\n\\n amounts = dexRouter().getAmountsOut(_fromAmount, path);\\n\\n // sanity check arrays\\n require(len == amounts.length, \\\"Arrays unequal\\\");\\n require(_fromAmount == amounts[0], \\\"Input amount mismatch\\\");\\n }\\n\\n /**\\n * @notice Show all pool token addresses that can be used to retired.\\n * @param _fromToken a list of token symbols that can be retired.\\n * @param _toToken a list of token symbols that can be retired.\\n */\\n function generatePath(\\n address _fromToken,\\n address _toToken\\n ) internal view returns (address[] memory path) {\\n uint256 len = eligibleSwapPaths[_fromToken].length;\\n if (len == 1) {\\n path = new address[](2);\\n path[0] = _fromToken;\\n path[1] = _toToken;\\n return path;\\n }\\n if (len == 2) {\\n path = new address[](3);\\n path[0] = _fromToken;\\n path[1] = eligibleSwapPaths[_fromToken][1];\\n path[2] = _toToken;\\n return path;\\n }\\n if (len == 3) {\\n path = new address[](3);\\n path[0] = _fromToken;\\n path[1] = eligibleSwapPaths[_fromToken][1];\\n path[2] = eligibleSwapPaths[_fromToken][2];\\n path[3] = _toToken;\\n return path;\\n } else {\\n path = new address[](4);\\n path[0] = _fromToken;\\n path[1] = eligibleSwapPaths[_fromToken][1];\\n path[2] = eligibleSwapPaths[_fromToken][2];\\n path[3] = eligibleSwapPaths[_fromToken][3];\\n path[4] = _toToken;\\n return path;\\n }\\n }\\n\\n function dexRouter() internal view returns (IUniswapV2Router02) {\\n return IUniswapV2Router02(dexRouterAddress);\\n }\\n\\n // ----------------------------------------\\n // Private functions\\n // ----------------------------------------\\n\\n /**\\n * @notice Checks whether an address is a pool token address\\n * @param _erc20Address address of token to be checked\\n * @return True if the address is a pool token address\\n */\\n function isRedeemable(address _erc20Address) private view returns (bool) {\\n for (uint i = 0; i < poolAddresses.length; i++) {\\n if (poolAddresses[i] == _erc20Address) {\\n return true;\\n }\\n }\\n\\n return false;\\n }\\n\\n /**\\n * @notice Checks whether an address can be used in a token swap\\n * @param _erc20Address address of token to be checked\\n * @return True if the specified address can be used in a swap\\n */\\n function isSwappable(address _erc20Address) private view returns (bool) {\\n for (uint i = 0; i < paths.length; i++) {\\n if (paths[i][0] == _erc20Address) {\\n return true;\\n }\\n }\\n\\n return false;\\n }\\n\\n // ----------------------------------------\\n // Admin methods\\n // ----------------------------------------\\n\\n /**\\n * @notice Checks if ERC20 Token is eligible for Offsetting.\\n * @param _erc20Address The address of the ERC20 token that the user sends\\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\\n * @return _path Returns the path of the token to be exchanged\\n */\\n\\n function isERC20AddressEligible(\\n address _erc20Address\\n ) public view returns (address[] memory _path) {\\n _path = eligibleSwapPaths[_erc20Address];\\n }\\n\\n /**\\n * @notice Change or add eligible paths and their addresses.\\n * @param _tokenSymbol The symbol of the token to add\\n * @param _path The path of the path to add\\n */\\n function addPath(\\n string memory _tokenSymbol,\\n address[] memory _path\\n ) public virtual onlyOwner {\\n eligibleSwapPaths[_path[0]] = _path;\\n eligibleSwapPathsBySymbol[_tokenSymbol] = _path;\\n tokenSymbolsForPaths.push(_tokenSymbol);\\n }\\n\\n /**\\n * @notice Delete eligible tokens stored in the contract.\\n * @param _tokenSymbol The symbol of the path to remove\\n */\\n function removePath(string memory _tokenSymbol) public virtual onlyOwner {\\n delete eligibleSwapPaths[eligibleSwapPathsBySymbol[_tokenSymbol][0]];\\n delete eligibleSwapPathsBySymbol[_tokenSymbol];\\n }\\n\\n /**\\n * @notice Cheks if Pool Token is eligible for Offsetting.\\n * @param _poolToken The addresses of the pool token to redeem\\n * @return _isEligible Returns if token can be redeemed\\n */\\n\\n function isPoolAddressEligible(\\n address _poolToken\\n ) public view returns (bool _isEligible) {\\n _isEligible = isRedeemable(_poolToken);\\n }\\n\\n /**\\n * @notice Change or add pool token addresses.\\n * @param _poolToken The address of the pool token to add\\n */\\n function addPoolToken(address _poolToken) public virtual onlyOwner {\\n poolAddresses.push(_poolToken);\\n }\\n\\n /**\\n * @notice Delete eligible pool token addresses stored in the contract.\\n * @param _poolToken The address of the pool token to remove\\n */\\n function removePoolToken(address _poolToken) public virtual onlyOwner {\\n for (uint256 i; i < poolAddresses.length; i++) {\\n if (poolAddresses[i] == _poolToken) {\\n poolAddresses[i] = poolAddresses[poolAddresses.length - 1];\\n poolAddresses.pop();\\n break;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf85a61eab51c68683a095be0c776a9a99bf70aa2dc5c65863176be9c17fb0c12\",\"license\":\"GPL-3.0\"},\"contracts/OffsetHelperStorage.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2022 Toucan Labs\\n//\\n// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract OffsetHelperStorage is Ownable {\\n // token symbol => token address\\n mapping(address => address[]) public eligibleSwapPaths;\\n mapping(string => address[]) public eligibleSwapPathsBySymbol;\\n\\n address[] public poolAddresses;\\n string[] public tokenSymbolsForPaths;\\n address[][] public paths;\\n address public dexRouterAddress;\\n}\\n\",\"keccak256\":\"0x6cd0dc999b167d00debeec534e1637cbefa552bdb801e672a20915b90bab20d0\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IToucanCarbonOffsets.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\\\";\\n\\nimport \\\"../types/CarbonProjectTypes.sol\\\";\\nimport \\\"../types/CarbonProjectVintageTypes.sol\\\";\\n\\ninterface IToucanCarbonOffsets is IERC20Upgradeable, IERC721Receiver {\\n function getGlobalProjectVintageIdentifiers()\\n external\\n view\\n returns (string memory, string memory);\\n\\n function getAttributes()\\n external\\n view\\n returns (ProjectData memory, VintageData memory);\\n\\n function getRemaining() external view returns (uint256 remaining);\\n\\n function getDepositCap() external view returns (uint256);\\n\\n function retire(uint256 amount) external;\\n\\n function retireFrom(address account, uint256 amount) external;\\n\\n function mintCertificateLegacy(\\n string calldata retiringEntityString,\\n address beneficiary,\\n string calldata beneficiaryString,\\n string calldata retirementMessage,\\n uint256 amount\\n ) external;\\n\\n function retireAndMintCertificate(\\n string calldata retiringEntityString,\\n address beneficiary,\\n string calldata beneficiaryString,\\n string calldata retirementMessage,\\n uint256 amount\\n ) external;\\n}\\n\",\"keccak256\":\"0x46c4ed2acd84764d0dd68c9c475e2c6ec3229a686046db48aca77ccd298d4b48\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/IToucanContractRegistry.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\npragma solidity ^0.8.0;\\n\\ninterface IToucanContractRegistry {\\n function carbonOffsetBatchesAddress() external view returns (address);\\n\\n function carbonProjectsAddress() external view returns (address);\\n\\n function carbonProjectVintagesAddress() external view returns (address);\\n\\n function toucanCarbonOffsetsFactoryAddress()\\n external\\n view\\n returns (address);\\n\\n function carbonOffsetBadgesAddress() external view returns (address);\\n\\n function checkERC20(address _address) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xa8451ff2527948e4eed26e97247b979212ccb3bd89506302b6c09ddbad392035\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/IToucanPoolToken.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\n\\ninterface IToucanPoolToken is IERC20Upgradeable {\\n function deposit(address erc20Addr, uint256 amount) external;\\n\\n function checkEligible(address erc20Addr) external view returns (bool);\\n\\n function checkAttributeMatching(address erc20Addr)\\n external\\n view\\n returns (bool);\\n\\n function calculateRedeemFees(\\n address[] memory tco2s,\\n uint256[] memory amounts\\n ) external view returns (uint256);\\n\\n function redeemMany(address[] memory tco2s, uint256[] memory amounts)\\n external;\\n\\n function redeemAuto(uint256 amount) external;\\n\\n function redeemAuto2(uint256 amount)\\n external\\n returns (address[] memory tco2s, uint256[] memory amounts);\\n\\n function getRemaining() external view returns (uint256);\\n\\n function getScoredTCO2s() external view returns (address[] memory);\\n}\\n\",\"keccak256\":\"0xef39949a81cf4ed78d789a1aac5c5860de1582be70de7435f1671931091d43a7\",\"license\":\"UNLICENSED\"},\"contracts/types/CarbonProjectTypes.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @dev CarbonProject related data and attributes\\nstruct ProjectData {\\n string projectId;\\n string standard;\\n string methodology;\\n string region;\\n string storageMethod;\\n string method;\\n string emissionType;\\n string category;\\n string uri;\\n address controller;\\n}\\n\",\"keccak256\":\"0x10d52f79d4bb8dbfe0abbb1662059d6d0193fe5794977b66aacf741451e25401\",\"license\":\"UNLICENSED\"},\"contracts/types/CarbonProjectVintageTypes.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\nstruct VintageData {\\n /// @dev A human-readable string which differentiates this from other vintages in\\n /// the same project, and helps build the corresponding TCO2 name and symbol.\\n string name;\\n uint64 startTime; // UNIX timestamp\\n uint64 endTime; // UNIX timestamp\\n uint256 projectTokenId;\\n uint64 totalVintageQuantity;\\n bool isCorsiaCompliant;\\n bool isCCPcompliant;\\n string coBenefits;\\n string correspAdjustment;\\n string additionalCertification;\\n string uri;\\n}\\n\",\"keccak256\":\"0x3a52e88a48b87f1ca3992c201f8b786ccf3aeb74796510893f8e33b33eae251b\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b5060405162003c5338038062003c538339810160408190526200003491620005df565b6200003f3362000207565b83516200005490600390602087019062000257565b5082516200006a906004906020860190620002c1565b5081516200008090600590602085019062000321565b50600680546001600160a01b0319166001600160a01b038316179055825160005b81811015620001fb57838181518110620000cb57634e487b7160e01b600052603260045260246000fd5b602002602001015160016000868481518110620000f857634e487b7160e01b600052603260045260246000fd5b60200260200101516000815181106200012157634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002090805190602001906200015e92919062000257565b508381815181106200018057634e487b7160e01b600052603260045260246000fd5b60200260200101516002868381518110620001ab57634e487b7160e01b600052603260045260246000fd5b6020026020010151604051620001c2919062000756565b90815260200160405180910390209080519060200190620001e592919062000257565b5080620001f2816200083d565b915050620000a1565b5050505050506200087b565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b828054828255906000526020600020908101928215620002af579160200282015b82811115620002af57825182546001600160a01b0319166001600160a01b0390911617825560209092019160019091019062000278565b50620002bd92915062000381565b5090565b82805482825590600052602060002090810192821562000313579160200282015b828111156200031357825180516200030291849160209091019062000398565b5091602001919060010190620002e2565b50620002bd92915062000415565b82805482825590600052602060002090810192821562000373579160200282015b828111156200037357825180516200036291849160209091019062000257565b509160200191906001019062000342565b50620002bd92915062000436565b5b80821115620002bd576000815560010162000382565b828054620003a69062000800565b90600052602060002090601f016020900481019282620003ca5760008555620002af565b82601f10620003e557805160ff1916838001178555620002af565b82800160010185558215620002af579182015b82811115620002af578251825591602001919060010190620003f8565b80821115620002bd5760006200042c828262000457565b5060010162000415565b80821115620002bd5760006200044d828262000499565b5060010162000436565b508054620004659062000800565b6000825580601f1062000476575050565b601f01602090049060005260206000209081019062000496919062000381565b50565b508054600082559060005260206000209081019062000496919062000381565b80516001600160a01b0381168114620004d157600080fd5b919050565b600082601f830112620004e7578081fd5b8151602062000500620004fa83620007a7565b62000774565b80838252828201915082860187848660051b890101111562000520578586fd5b855b8581101562000549576200053682620004b9565b8452928401929084019060010162000522565b5090979650505050505050565b600082601f83011262000567578081fd5b815160206200057a620004fa83620007a7565b80838252828201915082860187848660051b89010111156200059a578586fd5b855b85811015620005495781516001600160401b03811115620005bb578788fd5b620005cb8a87838c0101620004d6565b85525092840192908401906001016200059c565b60008060008060808587031215620005f5578384fd5b84516001600160401b03808211156200060c578586fd5b6200061a88838901620004d6565b9550602087015191508082111562000630578485fd5b818701915087601f83011262000644578485fd5b815162000655620004fa82620007a7565b80828252602082019150602085018b60208560051b880101111562000678578889fd5b885b84811015620007105781518681111562000692578a8bfd5b8701603f81018e13620006a3578a8bfd5b602081015187811115620006bb57620006bb62000865565b620006d0601f8201601f191660200162000774565b8181528f6040838501011115620006e5578c8dfd5b620006f8826020830160408601620007cd565b8652505060209384019391909101906001016200067a565b505060408a015190975093505050808211156200072b578384fd5b506200073a8782880162000556565b9250506200074b60608601620004b9565b905092959194509250565b600082516200076a818460208701620007cd565b9190910192915050565b604051601f8201601f191681016001600160401b03811182821017156200079f576200079f62000865565b604052919050565b60006001600160401b03821115620007c357620007c362000865565b5060051b60200190565b60005b83811015620007ea578181015183820152602001620007d0565b83811115620007fa576000848401525b50505050565b600181811c908216806200081557607f821691505b602082108114156200083757634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156200085e57634e487b7160e01b81526011600452602481fd5b5060010190565b634e487b7160e01b600052604160045260246000fd5b6133c8806200088b6000396000f3fe6080604052600436106101d15760003560e01c80638da5cb5b116100f7578063c0681c3d11610095578063e7f67fb111610064578063e7f67fb11461054e578063f04ad9d71461056e578063f2fde38b14610581578063feb21b9c146105a157600080fd5b8063c0681c3d146104db578063c6c53efb146104fb578063d08ec4751461051b578063d8a90c401461053b57600080fd5b8063a0cd6049116100d1578063a0cd60491461044b578063a2844a861461046b578063b4e76a861461049b578063b8baf9db146104bb57600080fd5b80638da5cb5b146103ed5780639753209d1461040b578063a09457221461042b57600080fd5b80635367cd9c1161016f578063715018a61161013e578063715018a61461037857806373200b111461038d57806382155e7e146103ad5780638474c288146103cd57600080fd5b80635367cd9c146102eb57806356a7de0d146102fe57806368d306d91461031e5780636d4565041461034b57600080fd5b80631a0fdecc116101ab5780631a0fdecc1461026a5780632e98c8141461028a57806335bab7e5146102ab5780634865b2b4146102cb57600080fd5b80631109ec99146101dd5780631357b113146102105780631661f8181461024857600080fd5b366101d857005b600080fd5b3480156101e957600080fd5b506101fd6101f8366004612ca7565b6105c1565b6040519081526020015b60405180910390f35b34801561021c57600080fd5b5061023061022b366004612ca7565b610695565b6040516001600160a01b039091168152602001610207565b34801561025457600080fd5b50610268610263366004612cd2565b6106cd565b005b34801561027657600080fd5b506101fd610285366004612c67565b61094a565b61029d610298366004612ca7565b6109dd565b6040516102079291906130a4565b3480156102b757600080fd5b506101fd6102c6366004612c67565b610a3a565b3480156102d757600080fd5b506101fd6102e6366004612c67565b610ba8565b6102686102f9366004612ca7565b610c33565b34801561030a57600080fd5b50610268610319366004612c44565b610eb9565b34801561032a57600080fd5b5061033e610339366004612c44565b611005565b6040516102079190613091565b34801561035757600080fd5b5061036b610366366004612f74565b61107b565b6040516102079190613107565b34801561038457600080fd5b50610268611127565b34801561039957600080fd5b506102306103a8366004612f31565b61113b565b3480156103b957600080fd5b5061029d6103c8366004612ca7565b611166565b3480156103d957600080fd5b506102686103e8366004612c67565b611322565b3480156103f957600080fd5b506000546001600160a01b0316610230565b34801561041757600080fd5b50610268610426366004612ea7565b6115ae565b34801561043757600080fd5b5061029d610446366004612c67565b611652565b34801561045757600080fd5b5061029d610466366004612c67565b611686565b34801561047757600080fd5b5061048b610486366004612c44565b6116b5565b6040519015158152602001610207565b3480156104a757600080fd5b506101fd6104b6366004612ca7565b6116c6565b3480156104c757600080fd5b506102686104d6366004612eda565b6117ba565b3480156104e757600080fd5b506102686104f6366004612c44565b61189f565b34801561050757600080fd5b50610230610516366004612fa4565b6118f9565b34801561052757600080fd5b5061029d610536366004612ca7565b611921565b6101fd610549366004612c44565b611939565b34801561055a57600080fd5b50600654610230906001600160a01b031681565b61029d61057c366004612c44565b611adc565b34801561058d57600080fd5b5061026861059c366004612c44565b611b3b565b3480156105ad57600080fd5b506102306105bc366004612f74565b611bb1565b6000826105cd81611bdb565b6105f25760405162461bcd60e51b81526004016105e990613171565b60405180910390fd5b6000600260405161060f9065574d4154494360d01b815260060190565b908152602001604051809103902060008154811061063d57634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b0316915061065e828787611c53565b9150508060008151811061068257634e487b7160e01b600052603260045260246000fd5b6020026020010151935050505092915050565b600160205281600052604060002081815481106106b157600080fd5b6000918252602090912001546001600160a01b03169150829050565b81518061070a5760405162461bcd60e51b815260206004820152600b60248201526a417272617920656d70747960a81b60448201526064016105e9565b8151811461072a5760405162461bcd60e51b81526004016105e9906131a0565b60005b818110156109445782818151811061075557634e487b7160e01b600052603260045260246000fd5b60200260200101516000141561076a57610932565b82818151811061078a57634e487b7160e01b600052603260045260246000fd5b60200260200101518482815181106107b257634e487b7160e01b600052603260045260246000fd5b60209081029190910101516040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b1580156107fd57600080fd5b505afa158015610811573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108359190612f8c565b10156108835760405162461bcd60e51b815260206004820152601960248201527f496e73756666696369656e742054434f322062616c616e63650000000000000060448201526064016105e9565b8381815181106108a357634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316633790cf578483815181106108d957634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b81526004016108ff91815260200190565b600060405180830381600087803b15801561091957600080fd5b505af115801561092d573d6000803e3d6000fd5b505050505b8061093c81613336565b91505061072d565b50505050565b60008361095681611d93565b6109725760405162461bcd60e51b81526004016105e99061313a565b8361097c81611bdb565b6109985760405162461bcd60e51b81526004016105e990613171565b60006109a5878787611c53565b915050806000815181106109c957634e487b7160e01b600052603260045260246000fd5b602002602001015193505050509392505050565b60608061a4ec46141580156109f4575061aef34614155b610a105760405162461bcd60e51b81526004016105e9906131c8565b610a1a8484610c33565b610a248484611166565b9092509050610a3382826106cd565b9250929050565b600083610a4681611d93565b610a625760405162461bcd60e51b81526004016105e99061313a565b83610a6c81611bdb565b610a885760405162461bcd60e51b81526004016105e990613171565b6000610a948787611e2c565b8051909150610aae6001600160a01b03891633308961242a565b600654610ac8906001600160a01b038a8116911688612495565b6000610adc6006546001600160a01b031690565b6001600160a01b03166338ed17398860008630426040518663ffffffff1660e01b8152600401610b10959493929190613227565b600060405180830381600087803b158015610b2a57600080fd5b505af1158015610b3e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b669190810190612e54565b905080610b746001846132b8565b81518110610b9257634e487b7160e01b600052603260045260246000fd5b6020026020010151955050505050509392505050565b600083610bb481611d93565b610bd05760405162461bcd60e51b81526004016105e99061313a565b83610bda81611bdb565b610bf65760405162461bcd60e51b81526004016105e990613171565b6000610c038787876125b9565b9150508060018251610c1591906132b8565b815181106109c957634e487b7160e01b600052603260045260246000fd5b61a4ec4614158015610c47575061aef34614155b610c635760405162461bcd60e51b81526004016105e9906131c8565b81610c6d81611bdb565b610c895760405162461bcd60e51b81526004016105e990613171565b60006002604051610ca69065574d4154494360d01b815260060190565b9081526020016040518091039020600081548110610cd457634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b03169150610cf48286611e2c565b90506000610d0a6006546001600160a01b031690565b6001600160a01b031663fb3bdb4134878530426040518663ffffffff1660e01b8152600401610d3c94939291906130d2565b6000604051808303818588803b158015610d5557600080fd5b505af1158015610d69573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052610d929190810190612e54565b905080600081518110610db557634e487b7160e01b600052603260045260246000fd5b6020026020010151341115610eb157600081600081518110610de757634e487b7160e01b600052603260045260246000fd5b602002602001015134610dfa91906132b8565b604080516000808252602082019283905292935033918491610e1b91613037565b60006040518083038185875af1925050503d8060008114610e58576040519150601f19603f3d011682016040523d82523d6000602084013e610e5d565b606091505b5050905080610eae5760405162461bcd60e51b815260206004820152601b60248201527f4661696c656420746f2073656e6420737572706c7573206261636b000000000060448201526064016105e9565b50505b505050505050565b610ec16126ef565b60005b60035481101561100157816001600160a01b031660038281548110610ef957634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415610fef5760038054610f24906001906132b8565b81548110610f4257634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600380546001600160a01b039092169183908110610f7c57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506003805480610fc957634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b03191690550190555050565b80610ff981613336565b915050610ec4565b5050565b6001600160a01b03811660009081526001602090815260409182902080548351818402810184019094528084526060939283018282801561106f57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611051575b50505050509050919050565b6004818154811061108b57600080fd5b9060005260206000200160009150905080546110a6906132fb565b80601f01602080910402602001604051908101604052809291908181526020018280546110d2906132fb565b801561111f5780601f106110f45761010080835404028352916020019161111f565b820191906000526020600020905b81548152906001019060200180831161110257829003601f168201915b505050505081565b61112f6126ef565b6111396000612749565b565b815160208184018101805160028252928201918501919091209190528054829081106106b157600080fd5b6060808361117381611bdb565b61118f5760405162461bcd60e51b81526004016105e990613171565b6040516370a0823160e01b815230600482015284906001600160a01b038716906370a082319060240160206040518083038186803b1580156111d057600080fd5b505afa1580156111e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112089190612f8c565b10156112565760405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e74204e43542f4243542062616c616e63650000000060448201526064016105e9565b604051634c02cad160e01b81526004810185905285906001600160a01b03821690634c02cad190602401600060405180830381600087803b15801561129a57600080fd5b505af11580156112ae573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526112d69190810190612d8e565b60405191955093507f3d29f82a20ec733db9f357c4dc1ae0ee60c572cc4b877384aa4639e4d877b18890611311903390899088908890613053565b60405180910390a150509250929050565b8261132c81611d93565b6113485760405162461bcd60e51b81526004016105e99061313a565b8261135281611bdb565b61136e5760405162461bcd60e51b81526004016105e990613171565b60008061137c878787611c53565b915091506000816000815181106113a357634e487b7160e01b600052603260045260246000fd5b602090810291909101015190506113c56001600160a01b03891633308461242a565b60065460405163095ea7b360e01b81526001600160a01b039182166004820152602481018390529089169063095ea7b390604401602060405180830381600087803b15801561141357600080fd5b505af1158015611427573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144b9190612e87565b5060006114606006546001600160a01b031690565b6001600160a01b0316638803dbee88848730426040518663ffffffff1660e01b8152600401611493959493929190613227565b600060405180830381600087803b1580156114ad57600080fd5b505af11580156114c1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526114e99190810190612e54565b9050818160008151811061150d57634e487b7160e01b600052603260045260246000fd5b602002602001015110156115a35760065460405163095ea7b360e01b81526001600160a01b03918216600482015260006024820152908a169063095ea7b390604401602060405180830381600087803b15801561156957600080fd5b505af115801561157d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a19190612e87565b505b505050505050505050565b6115b66126ef565b600160006002836040516115ca9190613037565b90815260200160405180910390206000815481106115f857634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528201929092526040018120611625916129f8565b6002816040516116359190613037565b9081526020016040518091039020600061164f91906129f8565b50565b6060806000611662868686610a3a565b905061166e8582611166565b909350915061167d83836106cd565b50935093915050565b606080611694858585611322565b61169e8484611166565b90925090506116ad82826106cd565b935093915050565b60006116c082611bdb565b92915050565b600061a4ec46141580156116dc575061aef34614155b6116f85760405162461bcd60e51b81526004016105e9906131c8565b8261170281611bdb565b61171e5760405162461bcd60e51b81526004016105e990613171565b6000600260405161173b9065574d4154494360d01b815260060190565b908152602001604051809103902060008154811061176957634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b0316915061178a8287876125b9565b915050806001825161179c91906132b8565b8151811061068257634e487b7160e01b600052603260045260246000fd5b6117c26126ef565b8060016000836000815181106117e857634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000209080519060200190611823929190612a16565b50806002836040516118359190613037565b90815260200160405180910390209080519060200190611856929190612a16565b5060048054600181018255600091909152825161189a917f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b01906020850190612a7b565b505050565b6118a76126ef565b600380546001810182556000919091527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b0319166001600160a01b0392909216919091179055565b6005828154811061190957600080fd5b9060005260206000200181815481106106b157600080fd5b606080610a1a6001600160a01b03851633308661242a565b600061a4ec461415801561194f575061aef34614155b61196b5760405162461bcd60e51b81526004016105e9906131c8565b8161197581611bdb565b6119915760405162461bcd60e51b81526004016105e990613171565b60405165574d4154494360d01b8152349060009060029060060190815260200160405180910390206000815481106119d957634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b031691506119f98287611e2c565b80519091506000611a126006546001600160a01b031690565b6001600160a01b0316637ff36ab58660008630426040518663ffffffff1660e01b8152600401611a4594939291906130d2565b6000604051808303818588803b158015611a5e57600080fd5b505af1158015611a72573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052611a9b9190810190612e54565b905080611aa96001846132b8565b81518110611ac757634e487b7160e01b600052603260045260246000fd5b60200260200101519650505050505050919050565b60608061a4ec4614158015611af3575061aef34614155b611b0f5760405162461bcd60e51b81526004016105e9906131c8565b6000611b1a84611939565b9050611b268482611166565b9093509150611b3583836106cd565b50915091565b611b436126ef565b6001600160a01b038116611ba85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105e9565b61164f81612749565b60038181548110611bc157600080fd5b6000918252602090912001546001600160a01b0316905081565b6000805b600354811015611c4a57826001600160a01b031660038281548110611c1457634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415611c385750600192915050565b80611c4281613336565b915050611bdf565b50600092915050565b606080611c608585611e2c565b8051909250611c776006546001600160a01b031690565b6001600160a01b0316631f00ca7485856040518363ffffffff1660e01b8152600401611ca492919061320e565b60006040518083038186803b158015611cbc57600080fd5b505afa158015611cd0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611cf89190810190612e54565b915081518114611d1a5760405162461bcd60e51b81526004016105e9906131a0565b81611d266001836132b8565b81518110611d4457634e487b7160e01b600052603260045260246000fd5b6020026020010151841461167d5760405162461bcd60e51b815260206004820152601660248201527509eeae8e0eae840c2dadeeadce840dad2e6dac2e8c6d60531b60448201526064016105e9565b6000805b600554811015611c4a57826001600160a01b031660058281548110611dcc57634e487b7160e01b600052603260045260246000fd5b90600052602060002001600081548110611df657634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415611e1a5750600192915050565b80611e2481613336565b915050611d97565b6001600160a01b038216600090815260016020819052604090912054606091811415611efc5760408051600280825260608201835290916020830190803683370190505091508382600081518110611e9457634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508282600181518110611ed657634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050506116c0565b806002141561202e576040805160038082526080820190925290602082016060803683370190505091508382600081518110611f4857634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505060016000856001600160a01b03166001600160a01b03168152602001908152602001600020600181548110611fad57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b031682600181518110611fec57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508282600281518110611ed657634e487b7160e01b600052603260045260246000fd5b80600314156121eb57604080516003808252608082019092529060208201606080368337019050509150838260008151811061207a57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505060016000856001600160a01b03166001600160a01b031681526020019081526020016000206001815481106120df57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260018151811061211e57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526001909152604090208054600290811061216a57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826002815181106121a957634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508282600381518110611ed657634e487b7160e01b600052603260045260246000fd5b60408051600480825260a082019092529060208201608080368337019050509150838260008151811061222e57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505060016000856001600160a01b03166001600160a01b0316815260200190815260200160002060018154811061229357634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826001815181106122d257634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526001909152604090208054600290811061231e57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260028151811061235d57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092018101919091529085166000908152600190915260409020805460039081106123a957634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826003815181106123e857634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508282600481518110611ed657634e487b7160e01b600052603260045260246000fd5b6040516001600160a01b03808516602483015283166044820152606481018290526109449085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612799565b80158061251e5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b1580156124e457600080fd5b505afa1580156124f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061251c9190612f8c565b155b6125895760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016105e9565b6040516001600160a01b03831660248201526044810182905261189a90849063095ea7b360e01b9060640161245e565b6060806125c68585611e2c565b80519092506125dd6006546001600160a01b031690565b6001600160a01b031663d06ca61f85856040518363ffffffff1660e01b815260040161260a92919061320e565b60006040518083038186803b15801561262257600080fd5b505afa158015612636573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261265e9190810190612e54565b9150815181146126805760405162461bcd60e51b81526004016105e9906131a0565b816000815181106126a157634e487b7160e01b600052603260045260246000fd5b6020026020010151841461167d5760405162461bcd60e51b8152602060048201526015602482015274092dce0eae840c2dadeeadce840dad2e6dac2e8c6d605b1b60448201526064016105e9565b6000546001600160a01b031633146111395760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105e9565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006127ee826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661286b9092919063ffffffff16565b80519091501561189a578080602001905181019061280c9190612e87565b61189a5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016105e9565b606061287a8484600085612882565b949350505050565b6060824710156128e35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016105e9565b600080866001600160a01b031685876040516128ff9190613037565b60006040518083038185875af1925050503d806000811461293c576040519150601f19603f3d011682016040523d82523d6000602084013e612941565b606091505b50915091506129528783838761295d565b979650505050505050565b606083156129c95782516129c2576001600160a01b0385163b6129c25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105e9565b508161287a565b61287a83838151156129de5781518083602001fd5b8060405162461bcd60e51b81526004016105e99190613107565b508054600082559060005260206000209081019061164f9190612aef565b828054828255906000526020600020908101928215612a6b579160200282015b82811115612a6b57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190612a36565b50612a77929150612aef565b5090565b828054612a87906132fb565b90600052602060002090601f016020900481019282612aa95760008555612a6b565b82601f10612ac257805160ff1916838001178555612a6b565b82800160010185558215612a6b579182015b82811115612a6b578251825591602001919060010190612ad4565b5b80821115612a775760008155600101612af0565b600082601f830112612b14578081fd5b81356020612b29612b2483613294565b613263565b80838252828201915082860187848660051b8901011115612b48578586fd5b855b85811015612b6f578135612b5d8161337d565b84529284019290840190600101612b4a565b5090979650505050505050565b600082601f830112612b8c578081fd5b81516020612b9c612b2483613294565b80838252828201915082860187848660051b8901011115612bbb578586fd5b855b85811015612b6f57815184529284019290840190600101612bbd565b600082601f830112612be9578081fd5b813567ffffffffffffffff811115612c0357612c03613367565b612c16601f8201601f1916602001613263565b818152846020838601011115612c2a578283fd5b816020850160208301379081016020019190915292915050565b600060208284031215612c55578081fd5b8135612c608161337d565b9392505050565b600080600060608486031215612c7b578182fd5b8335612c868161337d565b92506020840135612c968161337d565b929592945050506040919091013590565b60008060408385031215612cb9578182fd5b8235612cc48161337d565b946020939093013593505050565b60008060408385031215612ce4578182fd5b823567ffffffffffffffff80821115612cfb578384fd5b612d0786838701612b04565b9350602091508185013581811115612d1d578384fd5b85019050601f81018613612d2f578283fd5b8035612d3d612b2482613294565b80828252848201915084840189868560051b8701011115612d5c578687fd5b8694505b83851015612d7e578035835260019490940193918501918501612d60565b5080955050505050509250929050565b60008060408385031215612da0578182fd5b825167ffffffffffffffff80821115612db7578384fd5b818501915085601f830112612dca578384fd5b81516020612dda612b2483613294565b8083825282820191508286018a848660051b8901011115612df9578889fd5b8896505b84871015612e24578051612e108161337d565b835260019690960195918301918301612dfd565b5091880151919650909350505080821115612e3d578283fd5b50612e4a85828601612b7c565b9150509250929050565b600060208284031215612e65578081fd5b815167ffffffffffffffff811115612e7b578182fd5b61287a84828501612b7c565b600060208284031215612e98578081fd5b81518015158114612c60578182fd5b600060208284031215612eb8578081fd5b813567ffffffffffffffff811115612ece578182fd5b61287a84828501612bd9565b60008060408385031215612eec578182fd5b823567ffffffffffffffff80821115612f03578384fd5b612f0f86838701612bd9565b93506020850135915080821115612f24578283fd5b50612e4a85828601612b04565b60008060408385031215612f43578182fd5b823567ffffffffffffffff811115612f59578283fd5b612f6585828601612bd9565b95602094909401359450505050565b600060208284031215612f85578081fd5b5035919050565b600060208284031215612f9d578081fd5b5051919050565b60008060408385031215612fb6578182fd5b50508035926020909101359150565b6000815180845260208085019450808401835b83811015612ffd5781516001600160a01b031687529582019590820190600101612fd8565b509495945050505050565b6000815180845260208085019450808401835b83811015612ffd5781518752958201959082019060010161301b565b600082516130498184602087016132cf565b9190910192915050565b6001600160a01b0385811682528416602082015260806040820181905260009061307f90830185612fc5565b82810360608401526129528185613008565b602081526000612c606020830184612fc5565b6040815260006130b76040830185612fc5565b82810360208401526130c98185613008565b95945050505050565b8481526080602082015260006130eb6080830186612fc5565b6001600160a01b03949094166040830152506060015292915050565b60208152600082518060208401526131268160408501602087016132cf565b601f01601f19169190910160400192915050565b60208082526017908201527f5061746820646f65736e2774207965742065786973742e000000000000000000604082015260600190565b6020808252601590820152742a37b5b2b7103737ba103932b232b2b6b0b136329760591b604082015260600190565b6020808252600e908201526d105c9c985e5cc81d5b995c5d585b60921b604082015260600190565b60208082526026908201527f5468652066756e6374696f6e206973206e6f7420617661696c61626c65206f6e6040820152651021b2b6379760d11b606082015260800190565b82815260406020820152600061287a6040830184612fc5565b85815284602082015260a06040820152600061324660a0830186612fc5565b6001600160a01b0394909416606083015250608001529392505050565b604051601f8201601f1916810167ffffffffffffffff8111828210171561328c5761328c613367565b604052919050565b600067ffffffffffffffff8211156132ae576132ae613367565b5060051b60200190565b6000828210156132ca576132ca613351565b500390565b60005b838110156132ea5781810151838201526020016132d2565b838111156109445750506000910152565b600181811c9082168061330f57607f821691505b6020821081141561333057634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561334a5761334a613351565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461164f57600080fdfea2646970667358221220ddc1eff4a35a6fbb1eda6b442a738a64ebb110c6ec2e6fa36a3949ae7d1985ea64736f6c63430008040033", + "deployedBytecode": "0x6080604052600436106101d15760003560e01c80638da5cb5b116100f7578063c0681c3d11610095578063e7f67fb111610064578063e7f67fb11461054e578063f04ad9d71461056e578063f2fde38b14610581578063feb21b9c146105a157600080fd5b8063c0681c3d146104db578063c6c53efb146104fb578063d08ec4751461051b578063d8a90c401461053b57600080fd5b8063a0cd6049116100d1578063a0cd60491461044b578063a2844a861461046b578063b4e76a861461049b578063b8baf9db146104bb57600080fd5b80638da5cb5b146103ed5780639753209d1461040b578063a09457221461042b57600080fd5b80635367cd9c1161016f578063715018a61161013e578063715018a61461037857806373200b111461038d57806382155e7e146103ad5780638474c288146103cd57600080fd5b80635367cd9c146102eb57806356a7de0d146102fe57806368d306d91461031e5780636d4565041461034b57600080fd5b80631a0fdecc116101ab5780631a0fdecc1461026a5780632e98c8141461028a57806335bab7e5146102ab5780634865b2b4146102cb57600080fd5b80631109ec99146101dd5780631357b113146102105780631661f8181461024857600080fd5b366101d857005b600080fd5b3480156101e957600080fd5b506101fd6101f8366004612ca7565b6105c1565b6040519081526020015b60405180910390f35b34801561021c57600080fd5b5061023061022b366004612ca7565b610695565b6040516001600160a01b039091168152602001610207565b34801561025457600080fd5b50610268610263366004612cd2565b6106cd565b005b34801561027657600080fd5b506101fd610285366004612c67565b61094a565b61029d610298366004612ca7565b6109dd565b6040516102079291906130a4565b3480156102b757600080fd5b506101fd6102c6366004612c67565b610a3a565b3480156102d757600080fd5b506101fd6102e6366004612c67565b610ba8565b6102686102f9366004612ca7565b610c33565b34801561030a57600080fd5b50610268610319366004612c44565b610eb9565b34801561032a57600080fd5b5061033e610339366004612c44565b611005565b6040516102079190613091565b34801561035757600080fd5b5061036b610366366004612f74565b61107b565b6040516102079190613107565b34801561038457600080fd5b50610268611127565b34801561039957600080fd5b506102306103a8366004612f31565b61113b565b3480156103b957600080fd5b5061029d6103c8366004612ca7565b611166565b3480156103d957600080fd5b506102686103e8366004612c67565b611322565b3480156103f957600080fd5b506000546001600160a01b0316610230565b34801561041757600080fd5b50610268610426366004612ea7565b6115ae565b34801561043757600080fd5b5061029d610446366004612c67565b611652565b34801561045757600080fd5b5061029d610466366004612c67565b611686565b34801561047757600080fd5b5061048b610486366004612c44565b6116b5565b6040519015158152602001610207565b3480156104a757600080fd5b506101fd6104b6366004612ca7565b6116c6565b3480156104c757600080fd5b506102686104d6366004612eda565b6117ba565b3480156104e757600080fd5b506102686104f6366004612c44565b61189f565b34801561050757600080fd5b50610230610516366004612fa4565b6118f9565b34801561052757600080fd5b5061029d610536366004612ca7565b611921565b6101fd610549366004612c44565b611939565b34801561055a57600080fd5b50600654610230906001600160a01b031681565b61029d61057c366004612c44565b611adc565b34801561058d57600080fd5b5061026861059c366004612c44565b611b3b565b3480156105ad57600080fd5b506102306105bc366004612f74565b611bb1565b6000826105cd81611bdb565b6105f25760405162461bcd60e51b81526004016105e990613171565b60405180910390fd5b6000600260405161060f9065574d4154494360d01b815260060190565b908152602001604051809103902060008154811061063d57634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b0316915061065e828787611c53565b9150508060008151811061068257634e487b7160e01b600052603260045260246000fd5b6020026020010151935050505092915050565b600160205281600052604060002081815481106106b157600080fd5b6000918252602090912001546001600160a01b03169150829050565b81518061070a5760405162461bcd60e51b815260206004820152600b60248201526a417272617920656d70747960a81b60448201526064016105e9565b8151811461072a5760405162461bcd60e51b81526004016105e9906131a0565b60005b818110156109445782818151811061075557634e487b7160e01b600052603260045260246000fd5b60200260200101516000141561076a57610932565b82818151811061078a57634e487b7160e01b600052603260045260246000fd5b60200260200101518482815181106107b257634e487b7160e01b600052603260045260246000fd5b60209081029190910101516040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b1580156107fd57600080fd5b505afa158015610811573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108359190612f8c565b10156108835760405162461bcd60e51b815260206004820152601960248201527f496e73756666696369656e742054434f322062616c616e63650000000000000060448201526064016105e9565b8381815181106108a357634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316633790cf578483815181106108d957634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b81526004016108ff91815260200190565b600060405180830381600087803b15801561091957600080fd5b505af115801561092d573d6000803e3d6000fd5b505050505b8061093c81613336565b91505061072d565b50505050565b60008361095681611d93565b6109725760405162461bcd60e51b81526004016105e99061313a565b8361097c81611bdb565b6109985760405162461bcd60e51b81526004016105e990613171565b60006109a5878787611c53565b915050806000815181106109c957634e487b7160e01b600052603260045260246000fd5b602002602001015193505050509392505050565b60608061a4ec46141580156109f4575061aef34614155b610a105760405162461bcd60e51b81526004016105e9906131c8565b610a1a8484610c33565b610a248484611166565b9092509050610a3382826106cd565b9250929050565b600083610a4681611d93565b610a625760405162461bcd60e51b81526004016105e99061313a565b83610a6c81611bdb565b610a885760405162461bcd60e51b81526004016105e990613171565b6000610a948787611e2c565b8051909150610aae6001600160a01b03891633308961242a565b600654610ac8906001600160a01b038a8116911688612495565b6000610adc6006546001600160a01b031690565b6001600160a01b03166338ed17398860008630426040518663ffffffff1660e01b8152600401610b10959493929190613227565b600060405180830381600087803b158015610b2a57600080fd5b505af1158015610b3e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b669190810190612e54565b905080610b746001846132b8565b81518110610b9257634e487b7160e01b600052603260045260246000fd5b6020026020010151955050505050509392505050565b600083610bb481611d93565b610bd05760405162461bcd60e51b81526004016105e99061313a565b83610bda81611bdb565b610bf65760405162461bcd60e51b81526004016105e990613171565b6000610c038787876125b9565b9150508060018251610c1591906132b8565b815181106109c957634e487b7160e01b600052603260045260246000fd5b61a4ec4614158015610c47575061aef34614155b610c635760405162461bcd60e51b81526004016105e9906131c8565b81610c6d81611bdb565b610c895760405162461bcd60e51b81526004016105e990613171565b60006002604051610ca69065574d4154494360d01b815260060190565b9081526020016040518091039020600081548110610cd457634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b03169150610cf48286611e2c565b90506000610d0a6006546001600160a01b031690565b6001600160a01b031663fb3bdb4134878530426040518663ffffffff1660e01b8152600401610d3c94939291906130d2565b6000604051808303818588803b158015610d5557600080fd5b505af1158015610d69573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052610d929190810190612e54565b905080600081518110610db557634e487b7160e01b600052603260045260246000fd5b6020026020010151341115610eb157600081600081518110610de757634e487b7160e01b600052603260045260246000fd5b602002602001015134610dfa91906132b8565b604080516000808252602082019283905292935033918491610e1b91613037565b60006040518083038185875af1925050503d8060008114610e58576040519150601f19603f3d011682016040523d82523d6000602084013e610e5d565b606091505b5050905080610eae5760405162461bcd60e51b815260206004820152601b60248201527f4661696c656420746f2073656e6420737572706c7573206261636b000000000060448201526064016105e9565b50505b505050505050565b610ec16126ef565b60005b60035481101561100157816001600160a01b031660038281548110610ef957634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415610fef5760038054610f24906001906132b8565b81548110610f4257634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600380546001600160a01b039092169183908110610f7c57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506003805480610fc957634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b03191690550190555050565b80610ff981613336565b915050610ec4565b5050565b6001600160a01b03811660009081526001602090815260409182902080548351818402810184019094528084526060939283018282801561106f57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611051575b50505050509050919050565b6004818154811061108b57600080fd5b9060005260206000200160009150905080546110a6906132fb565b80601f01602080910402602001604051908101604052809291908181526020018280546110d2906132fb565b801561111f5780601f106110f45761010080835404028352916020019161111f565b820191906000526020600020905b81548152906001019060200180831161110257829003601f168201915b505050505081565b61112f6126ef565b6111396000612749565b565b815160208184018101805160028252928201918501919091209190528054829081106106b157600080fd5b6060808361117381611bdb565b61118f5760405162461bcd60e51b81526004016105e990613171565b6040516370a0823160e01b815230600482015284906001600160a01b038716906370a082319060240160206040518083038186803b1580156111d057600080fd5b505afa1580156111e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112089190612f8c565b10156112565760405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e74204e43542f4243542062616c616e63650000000060448201526064016105e9565b604051634c02cad160e01b81526004810185905285906001600160a01b03821690634c02cad190602401600060405180830381600087803b15801561129a57600080fd5b505af11580156112ae573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526112d69190810190612d8e565b60405191955093507f3d29f82a20ec733db9f357c4dc1ae0ee60c572cc4b877384aa4639e4d877b18890611311903390899088908890613053565b60405180910390a150509250929050565b8261132c81611d93565b6113485760405162461bcd60e51b81526004016105e99061313a565b8261135281611bdb565b61136e5760405162461bcd60e51b81526004016105e990613171565b60008061137c878787611c53565b915091506000816000815181106113a357634e487b7160e01b600052603260045260246000fd5b602090810291909101015190506113c56001600160a01b03891633308461242a565b60065460405163095ea7b360e01b81526001600160a01b039182166004820152602481018390529089169063095ea7b390604401602060405180830381600087803b15801561141357600080fd5b505af1158015611427573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144b9190612e87565b5060006114606006546001600160a01b031690565b6001600160a01b0316638803dbee88848730426040518663ffffffff1660e01b8152600401611493959493929190613227565b600060405180830381600087803b1580156114ad57600080fd5b505af11580156114c1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526114e99190810190612e54565b9050818160008151811061150d57634e487b7160e01b600052603260045260246000fd5b602002602001015110156115a35760065460405163095ea7b360e01b81526001600160a01b03918216600482015260006024820152908a169063095ea7b390604401602060405180830381600087803b15801561156957600080fd5b505af115801561157d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a19190612e87565b505b505050505050505050565b6115b66126ef565b600160006002836040516115ca9190613037565b90815260200160405180910390206000815481106115f857634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528201929092526040018120611625916129f8565b6002816040516116359190613037565b9081526020016040518091039020600061164f91906129f8565b50565b6060806000611662868686610a3a565b905061166e8582611166565b909350915061167d83836106cd565b50935093915050565b606080611694858585611322565b61169e8484611166565b90925090506116ad82826106cd565b935093915050565b60006116c082611bdb565b92915050565b600061a4ec46141580156116dc575061aef34614155b6116f85760405162461bcd60e51b81526004016105e9906131c8565b8261170281611bdb565b61171e5760405162461bcd60e51b81526004016105e990613171565b6000600260405161173b9065574d4154494360d01b815260060190565b908152602001604051809103902060008154811061176957634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b0316915061178a8287876125b9565b915050806001825161179c91906132b8565b8151811061068257634e487b7160e01b600052603260045260246000fd5b6117c26126ef565b8060016000836000815181106117e857634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000209080519060200190611823929190612a16565b50806002836040516118359190613037565b90815260200160405180910390209080519060200190611856929190612a16565b5060048054600181018255600091909152825161189a917f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b01906020850190612a7b565b505050565b6118a76126ef565b600380546001810182556000919091527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b0319166001600160a01b0392909216919091179055565b6005828154811061190957600080fd5b9060005260206000200181815481106106b157600080fd5b606080610a1a6001600160a01b03851633308661242a565b600061a4ec461415801561194f575061aef34614155b61196b5760405162461bcd60e51b81526004016105e9906131c8565b8161197581611bdb565b6119915760405162461bcd60e51b81526004016105e990613171565b60405165574d4154494360d01b8152349060009060029060060190815260200160405180910390206000815481106119d957634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b031691506119f98287611e2c565b80519091506000611a126006546001600160a01b031690565b6001600160a01b0316637ff36ab58660008630426040518663ffffffff1660e01b8152600401611a4594939291906130d2565b6000604051808303818588803b158015611a5e57600080fd5b505af1158015611a72573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052611a9b9190810190612e54565b905080611aa96001846132b8565b81518110611ac757634e487b7160e01b600052603260045260246000fd5b60200260200101519650505050505050919050565b60608061a4ec4614158015611af3575061aef34614155b611b0f5760405162461bcd60e51b81526004016105e9906131c8565b6000611b1a84611939565b9050611b268482611166565b9093509150611b3583836106cd565b50915091565b611b436126ef565b6001600160a01b038116611ba85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105e9565b61164f81612749565b60038181548110611bc157600080fd5b6000918252602090912001546001600160a01b0316905081565b6000805b600354811015611c4a57826001600160a01b031660038281548110611c1457634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415611c385750600192915050565b80611c4281613336565b915050611bdf565b50600092915050565b606080611c608585611e2c565b8051909250611c776006546001600160a01b031690565b6001600160a01b0316631f00ca7485856040518363ffffffff1660e01b8152600401611ca492919061320e565b60006040518083038186803b158015611cbc57600080fd5b505afa158015611cd0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611cf89190810190612e54565b915081518114611d1a5760405162461bcd60e51b81526004016105e9906131a0565b81611d266001836132b8565b81518110611d4457634e487b7160e01b600052603260045260246000fd5b6020026020010151841461167d5760405162461bcd60e51b815260206004820152601660248201527509eeae8e0eae840c2dadeeadce840dad2e6dac2e8c6d60531b60448201526064016105e9565b6000805b600554811015611c4a57826001600160a01b031660058281548110611dcc57634e487b7160e01b600052603260045260246000fd5b90600052602060002001600081548110611df657634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415611e1a5750600192915050565b80611e2481613336565b915050611d97565b6001600160a01b038216600090815260016020819052604090912054606091811415611efc5760408051600280825260608201835290916020830190803683370190505091508382600081518110611e9457634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508282600181518110611ed657634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050506116c0565b806002141561202e576040805160038082526080820190925290602082016060803683370190505091508382600081518110611f4857634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505060016000856001600160a01b03166001600160a01b03168152602001908152602001600020600181548110611fad57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b031682600181518110611fec57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508282600281518110611ed657634e487b7160e01b600052603260045260246000fd5b80600314156121eb57604080516003808252608082019092529060208201606080368337019050509150838260008151811061207a57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505060016000856001600160a01b03166001600160a01b031681526020019081526020016000206001815481106120df57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260018151811061211e57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526001909152604090208054600290811061216a57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826002815181106121a957634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508282600381518110611ed657634e487b7160e01b600052603260045260246000fd5b60408051600480825260a082019092529060208201608080368337019050509150838260008151811061222e57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505060016000856001600160a01b03166001600160a01b0316815260200190815260200160002060018154811061229357634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826001815181106122d257634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526001909152604090208054600290811061231e57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260028151811061235d57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092018101919091529085166000908152600190915260409020805460039081106123a957634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826003815181106123e857634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508282600481518110611ed657634e487b7160e01b600052603260045260246000fd5b6040516001600160a01b03808516602483015283166044820152606481018290526109449085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612799565b80158061251e5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b1580156124e457600080fd5b505afa1580156124f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061251c9190612f8c565b155b6125895760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016105e9565b6040516001600160a01b03831660248201526044810182905261189a90849063095ea7b360e01b9060640161245e565b6060806125c68585611e2c565b80519092506125dd6006546001600160a01b031690565b6001600160a01b031663d06ca61f85856040518363ffffffff1660e01b815260040161260a92919061320e565b60006040518083038186803b15801561262257600080fd5b505afa158015612636573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261265e9190810190612e54565b9150815181146126805760405162461bcd60e51b81526004016105e9906131a0565b816000815181106126a157634e487b7160e01b600052603260045260246000fd5b6020026020010151841461167d5760405162461bcd60e51b8152602060048201526015602482015274092dce0eae840c2dadeeadce840dad2e6dac2e8c6d605b1b60448201526064016105e9565b6000546001600160a01b031633146111395760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105e9565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006127ee826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661286b9092919063ffffffff16565b80519091501561189a578080602001905181019061280c9190612e87565b61189a5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016105e9565b606061287a8484600085612882565b949350505050565b6060824710156128e35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016105e9565b600080866001600160a01b031685876040516128ff9190613037565b60006040518083038185875af1925050503d806000811461293c576040519150601f19603f3d011682016040523d82523d6000602084013e612941565b606091505b50915091506129528783838761295d565b979650505050505050565b606083156129c95782516129c2576001600160a01b0385163b6129c25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105e9565b508161287a565b61287a83838151156129de5781518083602001fd5b8060405162461bcd60e51b81526004016105e99190613107565b508054600082559060005260206000209081019061164f9190612aef565b828054828255906000526020600020908101928215612a6b579160200282015b82811115612a6b57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190612a36565b50612a77929150612aef565b5090565b828054612a87906132fb565b90600052602060002090601f016020900481019282612aa95760008555612a6b565b82601f10612ac257805160ff1916838001178555612a6b565b82800160010185558215612a6b579182015b82811115612a6b578251825591602001919060010190612ad4565b5b80821115612a775760008155600101612af0565b600082601f830112612b14578081fd5b81356020612b29612b2483613294565b613263565b80838252828201915082860187848660051b8901011115612b48578586fd5b855b85811015612b6f578135612b5d8161337d565b84529284019290840190600101612b4a565b5090979650505050505050565b600082601f830112612b8c578081fd5b81516020612b9c612b2483613294565b80838252828201915082860187848660051b8901011115612bbb578586fd5b855b85811015612b6f57815184529284019290840190600101612bbd565b600082601f830112612be9578081fd5b813567ffffffffffffffff811115612c0357612c03613367565b612c16601f8201601f1916602001613263565b818152846020838601011115612c2a578283fd5b816020850160208301379081016020019190915292915050565b600060208284031215612c55578081fd5b8135612c608161337d565b9392505050565b600080600060608486031215612c7b578182fd5b8335612c868161337d565b92506020840135612c968161337d565b929592945050506040919091013590565b60008060408385031215612cb9578182fd5b8235612cc48161337d565b946020939093013593505050565b60008060408385031215612ce4578182fd5b823567ffffffffffffffff80821115612cfb578384fd5b612d0786838701612b04565b9350602091508185013581811115612d1d578384fd5b85019050601f81018613612d2f578283fd5b8035612d3d612b2482613294565b80828252848201915084840189868560051b8701011115612d5c578687fd5b8694505b83851015612d7e578035835260019490940193918501918501612d60565b5080955050505050509250929050565b60008060408385031215612da0578182fd5b825167ffffffffffffffff80821115612db7578384fd5b818501915085601f830112612dca578384fd5b81516020612dda612b2483613294565b8083825282820191508286018a848660051b8901011115612df9578889fd5b8896505b84871015612e24578051612e108161337d565b835260019690960195918301918301612dfd565b5091880151919650909350505080821115612e3d578283fd5b50612e4a85828601612b7c565b9150509250929050565b600060208284031215612e65578081fd5b815167ffffffffffffffff811115612e7b578182fd5b61287a84828501612b7c565b600060208284031215612e98578081fd5b81518015158114612c60578182fd5b600060208284031215612eb8578081fd5b813567ffffffffffffffff811115612ece578182fd5b61287a84828501612bd9565b60008060408385031215612eec578182fd5b823567ffffffffffffffff80821115612f03578384fd5b612f0f86838701612bd9565b93506020850135915080821115612f24578283fd5b50612e4a85828601612b04565b60008060408385031215612f43578182fd5b823567ffffffffffffffff811115612f59578283fd5b612f6585828601612bd9565b95602094909401359450505050565b600060208284031215612f85578081fd5b5035919050565b600060208284031215612f9d578081fd5b5051919050565b60008060408385031215612fb6578182fd5b50508035926020909101359150565b6000815180845260208085019450808401835b83811015612ffd5781516001600160a01b031687529582019590820190600101612fd8565b509495945050505050565b6000815180845260208085019450808401835b83811015612ffd5781518752958201959082019060010161301b565b600082516130498184602087016132cf565b9190910192915050565b6001600160a01b0385811682528416602082015260806040820181905260009061307f90830185612fc5565b82810360608401526129528185613008565b602081526000612c606020830184612fc5565b6040815260006130b76040830185612fc5565b82810360208401526130c98185613008565b95945050505050565b8481526080602082015260006130eb6080830186612fc5565b6001600160a01b03949094166040830152506060015292915050565b60208152600082518060208401526131268160408501602087016132cf565b601f01601f19169190910160400192915050565b60208082526017908201527f5061746820646f65736e2774207965742065786973742e000000000000000000604082015260600190565b6020808252601590820152742a37b5b2b7103737ba103932b232b2b6b0b136329760591b604082015260600190565b6020808252600e908201526d105c9c985e5cc81d5b995c5d585b60921b604082015260600190565b60208082526026908201527f5468652066756e6374696f6e206973206e6f7420617661696c61626c65206f6e6040820152651021b2b6379760d11b606082015260800190565b82815260406020820152600061287a6040830184612fc5565b85815284602082015260a06040820152600061324660a0830186612fc5565b6001600160a01b0394909416606083015250608001529392505050565b604051601f8201601f1916810167ffffffffffffffff8111828210171561328c5761328c613367565b604052919050565b600067ffffffffffffffff8211156132ae576132ae613367565b5060051b60200190565b6000828210156132ca576132ca613351565b500390565b60005b838110156132ea5781810151838201526020016132d2565b838111156109445750506000910152565b600181811c9082168061330f57607f821691505b6020821081141561333057634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561334a5761334a613351565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461164f57600080fdfea2646970667358221220ddc1eff4a35a6fbb1eda6b442a738a64ebb110c6ec2e6fa36a3949ae7d1985ea64736f6c63430008040033", "devdoc": { "events": { "Redeemed(address,address,address[],uint256[])": { "params": { "amounts": "An array of the amounts of each TCO2 that were redeemed", - "poolToken": "The address of the Toucan pool token used in the redemption, e.g., NCT", + "poolToken": "The address of the pool token used in the redemption, e.g., NCT", "sender": "The sender of the transaction", "tco2s": "An array of the TCO2 addresses that were redeemed" } @@ -898,7 +828,7 @@ "autoOffsetExactInETH(address)": { "details": "This function is only available on Polygon, not on Celo.", "params": { - "_poolToken": "The address of the pool token to offset, e.g., NCT" + "_poolToken": "The address of the pool token to swap for, e.g., NCT" }, "returns": { "amounts": "An array of the amounts of each TCO2 that were redeemed", @@ -906,11 +836,11 @@ } }, "autoOffsetExactInToken(address,address,uint256)": { - "details": "When automatically redeeming pool tokens for the lowest quality TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool token.", + "details": "When automatically redeeming pool tokens for the oldest ones TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool token.", "params": { "_amountToSwap": "The amount of ERC20 token to swap into Toucan pool token. Full amount will be used for offsetting.", "_fromToken": "The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)", - "_poolToken": "The address of the pool token to offset, e.g., NCT" + "_poolToken": "The address of the pool token that the user wants to use, e.g., NCT" }, "returns": { "amounts": "An array of the amounts of each TCO2 that were redeemed", @@ -921,7 +851,7 @@ "details": "If the user sends too much native tokens , the leftover amount will be sent back to the user. This function is only available on Polygon, not on Celo.", "params": { "_amountToOffset": "The amount of TCO2 to offset.", - "_poolToken": "The address of the pool token to offset, e.g., NCT" + "_poolToken": "The address of the pool token to swap for, e.g., NCT" }, "returns": { "amounts": "An array of the amounts of each TCO2 that were redeemed", @@ -929,11 +859,11 @@ } }, "autoOffsetExactOutToken(address,address,uint256)": { - "details": "When automatically redeeming pool tokens for the lowest quality TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool token.", + "details": "When automatically redeeming pool tokens for the oldest ones TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool token.", "params": { "_amountToOffset": "The amount of TCO2 to offset", "_fromToken": "The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)", - "_poolToken": "The address of the Toucan pool token that the user wants to offset, e.g., NCT" + "_poolToken": "The address of the pool token that the user wants to use, e.g., NCT" }, "returns": { "amounts": "An array of the amounts of each TCO2 that were redeemed", @@ -943,7 +873,7 @@ "autoOffsetPoolToken(address,uint256)": { "params": { "_amountToOffset": "The amount of TCO2 to offset.", - "_poolToken": "The address of the pool token to offset, e.g., NCT" + "_poolToken": "The address of the pool token to swap for, e.g., NCT" }, "returns": { "amounts": "An array of the amounts of each TCO2 that were redeemed", @@ -988,7 +918,7 @@ }, "calculateNeededETHAmount(address,uint256)": { "params": { - "_poolToken": "The address of the pool token to swap for, e.g., NCT", + "_poolToken": "The address of the pool token to swap for, for example, NCT", "_toAmount": "The desired amount of pool token to receive" }, "returns": { @@ -1013,9 +943,6 @@ "_tokenSymbolsForPaths": "An array of symbols of the token the user want to retire carbon credits for" } }, - "deposit(address,uint256)": { - "details": "Needs to be approved" - }, "isERC20AddressEligible(address)": { "params": { "_erc20Address": "The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)" @@ -1026,10 +953,10 @@ }, "isPoolAddressEligible(address)": { "params": { - "_poolToken": "The address of the pool token to offset, e.g., NCT" + "_poolToken": "The addresses of the pool token to redeem" }, "returns": { - "_isEligible": "Returns a bool if the Pool token is eligible for offsetting" + "_isEligible": "Returns if token can be redeemed" } }, "owner()": { @@ -1053,24 +980,24 @@ "_poolToken": "The address of the pool token to swap for, e.g., NCT" }, "returns": { - "amountOut": "Resulting amount of Toucan pool token that got acquired for the swapped native tokens ." + "amountOut": "Resulting amount of pool token that got acquired for the swapped native tokens ." } }, "swapExactInToken(address,address,uint256)": { "details": "Needs to be approved on the client side.", "params": { - "_fromAmount": "The amount of ERC20 token to swap", + "_fromAmount": "The amount of ERC20 token to swap e.g., NCT", "_fromToken": "The address of the ERC20 token used for the swap", - "_poolToken": "The address of the pool token to swap for, e.g., NCT" + "_poolToken": "The address of the pool token to swap for," }, "returns": { - "amountOut": "Resulting amount of Toucan pool token that got acquired for the swapped ERC20 tokens." + "amountOut": "Resulting amount of pool token that got acquired for the swapped ERC20 tokens." } }, "swapExactOutETH(address,uint256)": { "params": { "_poolToken": "The address of the pool token to swap for, e.g., NCT", - "_toAmount": "The required amount of the Toucan pool token (NCT/BCT)" + "_toAmount": "The required amount of the pool token (NCT/BCT)" } }, "swapExactOutToken(address,address,uint256)": { @@ -1078,7 +1005,7 @@ "params": { "_fromToken": "The address of the ERC20 token used for the swap", "_poolToken": "The address of the pool token to swap for, e.g., NCT", - "_toAmount": "The required amount of the Toucan pool token (NCT/BCT)" + "_toAmount": "The required amount of the pool token (NCT/BCT)" } }, "transferOwnership(address)": { @@ -1103,19 +1030,19 @@ "notice": "Change or add pool token addresses." }, "autoOffsetExactInETH(address)": { - "notice": "Retire carbon credits using the lowest quality (oldest) TCO2 tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC. All provided native tokens is consumed for offsetting. The `view` helper function `calculateExpectedPoolTokenForETH()` can be used to calculate the expected amount of TCO2s that will be offset using `autoOffsetExactInETH()`. This function: 1. Swaps the native token e.g. MATIC sent to the contract for the specified pool token. 2. Redeems the pool token for the poorest quality TCO2 tokens available. 3. Retires the TCO2 tokens." + "notice": "Retire carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC. All provided native tokens is consumed for offsetting. Use `calculateExpectedPoolTokenForETH()` to calculate the expected amount of Pool token that can be acquired by swapping the provided amount of native tokens e.g., MATIC. This function: 1. Swaps the Matic sent to the contract for the specified pool token. 2. Redeems the pool token for the oldest TCO2 tokens available. 3. Retires the TCO2 tokens." }, "autoOffsetExactInToken(address,address,uint256)": { - "notice": "Retire carbon credits using the lowest quality (oldest) TCO2 tokens available from the specified Toucan token pool by sending ERC20 tokens (cUSD, USDC, WETH, WMATIC). All provided token is consumed for offsetting. The `view` helper function `calculateExpectedPoolTokenForToken()` can be used to calculate the expected amount of TCO2s that will be offset using `autoOffsetExactInToken()`. This function: 1. Swaps the ERC20 token sent to the contract for the specified pool token. 2. Redeems the pool token for the poorest quality TCO2 tokens available. 3. Retires the TCO2 tokens. Note: The client must approve the ERC20 token that is sent to the contract." + "notice": "Retire carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending ERC20 tokens (cUSD, USDC, WETH, WMATIC). All provided token is consumed for offsetting. Use `calculateExpectedPoolTokenForToken()` to calculate the expected amount of Pool token that can be acquired by swapping the provided amount of ERC20 token. This function: 1. Swaps the ERC20 token sent to the contract for the specified pool token. 2. Redeems the pool token for the oldest TCO2 tokens available. 3. Retires the TCO2 tokens. Note: The client must approve the ERC20 token that is sent to the contract." }, "autoOffsetExactOutETH(address,uint256)": { - "notice": "Retire carbon credits using the lowest quality (oldest) TCO2 tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC. The `view` helper function `calculateNeededETHAmount()` should be called before using `autoOffsetExactOutETH()`, to determine how much native tokens e.g., MATIC must be sent to the `OffsetHelper` contract in order to retire the specified amount of carbon. This function: 1. Swaps the native token e.g. MATIC sent to the contract for the specified pool token. 2. Redeems the pool token for the poorest quality TCO2 tokens available. 3. Retires the TCO2 tokens." + "notice": "Retire carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC. Use `calculateNeededETHAmount()` first in order to find out how much native tokens are required to retire the specified quantity of TCO2. This function: 1. Swaps the Matic sent to the contract for the specified pool token. 2. Redeems the pool token for the oldest TCO2 tokens available. 3. Retires the TCO2 tokens." }, "autoOffsetExactOutToken(address,address,uint256)": { - "notice": "Retire carbon credits using the lowest quality (oldest) TCO2 tokens available from the specified Toucan token pool by sending ERC20 tokens (cUSD, USDC, WETH, WMATIC). The `view` helper function `calculateNeededTokenAmount()` should be called before using `autoOffsetExactOutToken()`, to determine how much native tokens e.g., MATIC must be sent to the `OffsetHelper` contract in order to retire the specified amount of carbon. This function: 1. Swaps the ERC20 token sent to the contract for the specified pool token. 2. Redeems the pool token for the poorest quality TCO2 tokens available. 3. Retires the TCO2 tokens. Note: The client must approve the ERC20 token that is sent to the contract." + "notice": "Retire carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending ERC20 tokens (cUSD, USDC, WETH, WMATIC). Use `calculateNeededTokenAmount` first in order to find out how much of the ERC20 token is required to retire the specified quantity of TCO2. This function: 1. Swaps the ERC20 token sent to the contract for the specified pool token. 2. Redeems the pool token for the oldest TCO2 tokens available. 3. Retires the TCO2 tokens. Note: The client must approve the ERC20 token that is sent to the contract." }, "autoOffsetPoolToken(address,uint256)": { - "notice": "Retire carbon credits using the lowest quality (oldest) TCO2 tokens available by sending Toucan pool tokens, e.g., NCT. This function: 1. Redeems the pool token for the poorest quality TCO2 tokens available. 2. Retires the TCO2 tokens. Note: The client must approve the pool token that is sent." + "notice": "Retire carbon credits using the oldest TCO2 tokens available by sending pool tokens, e.g., NCT. This function: 1. Redeems the pool token for the oldest TCO2 tokens available. 2. Retires the TCO2 tokens. Note: The client must approve the pool token that is sent." }, "autoRedeem(address,uint256)": { "notice": "Redeems the specified amount of NCT / BCT for TCO2." @@ -1124,28 +1051,25 @@ "notice": "Retire the specified TCO2 tokens." }, "calculateExpectedPoolTokenForETH(address,uint256)": { - "notice": "Calculates the expected amount of Toucan Pool token that can be acquired by swapping the provided amount of native tokens e.g., MATIC." + "notice": "Calculates the expected amount of pool token that can be acquired by swapping the provided amount of native tokens e.g., MATIC." }, "calculateExpectedPoolTokenForToken(address,address,uint256)": { - "notice": "Calculates the expected amount of Toucan Pool token that can be acquired by swapping the provided amount of ERC20 token." + "notice": "Calculates the expected amount of pool token that can be acquired by swapping the provided amount of ERC20 token." }, "calculateNeededETHAmount(address,uint256)": { - "notice": "Return how much native tokens e.g, MATIC is required in order to swap for the desired amount of a Toucan pool token, e.g., NCT." + "notice": "Return how much native tokens e.g, MATIC is required in order to swap for the desired amount of a pool token, e.g., NCT." }, "calculateNeededTokenAmount(address,address,uint256)": { - "notice": "Return how much of the specified ERC20 token is required in order to swap for the desired amount of a Toucan pool token, for example, e.g., NCT." + "notice": "Return how much of the specified ERC20 token is required in order to swap for the desired amount of a pool token, for example, e.g., NCT." }, "constructor": { "notice": "Contract constructor. Should specify arrays of ERC20 symbols and addresses that can used by the contract." }, - "deposit(address,uint256)": { - "notice": "Allow users to deposit BCT / NCT." - }, "isERC20AddressEligible(address)": { - "notice": "Checks if ERC20 Token is eligible for swapping." + "notice": "Checks if ERC20 Token is eligible for Offsetting." }, "isPoolAddressEligible(address)": { - "notice": "Checks if Pool Address is eligible for offsetting." + "notice": "Cheks if Pool Token is eligible for Offsetting." }, "removePath(string)": { "notice": "Delete eligible tokens stored in the contract." @@ -1154,121 +1078,78 @@ "notice": "Delete eligible pool token addresses stored in the contract." }, "swapExactInETH(address)": { - "notice": "Swap native tokens e.g., MATIC for Toucan pool tokens (BCT/NCT) on SushiSwap. All provided native tokens will be swapped." + "notice": "Swap native tokens e.g., MATIC for pool tokens (BCT/NCT) on SushiSwap. All provided native tokens will be swapped." }, "swapExactInToken(address,address,uint256)": { - "notice": "Swap eligible ERC20 tokens for Toucan pool tokens (BCT/NCT) on SushiSwap. All provided ERC20 tokens will be swapped." + "notice": "Swap eligible ERC20 tokens for pool tokens (BCT/NCT) on SushiSwap. All provided ERC20 tokens will be swapped." }, "swapExactOutETH(address,uint256)": { - "notice": "Swap native tokens e.g., MATIC for Toucan pool tokens (BCT/NCT) on SushiSwap. Remaining native tokens that was not consumed by the swap is returned." + "notice": "Swap native tokens e.g., MATIC for pool tokens (BCT/NCT) on SushiSwap. Remaining native tokens that was not consumed by the swap is returned." }, "swapExactOutToken(address,address,uint256)": { - "notice": "Swap eligible ERC20 tokens for Toucan pool tokens (BCT/NCT) on SushiSwap" - }, - "withdraw(address,uint256)": { - "notice": "Allow users to withdraw tokens they have deposited." + "notice": "Swap eligible ERC20 tokens for pool tokens (BCT/NCT) on SushiSwap" } }, - "notice": "Helper functions that simplify the carbon offsetting (retirement) process. Retiring carbon tokens requires multiple steps and interactions with Toucan Protocol's main contracts: 1. Obtain a Toucan pool token e.g., NCT (by performing a token swap on a DEX). 2. Redeem the pool token for a TCO2 token. 3. Retire the TCO2 token. These steps are combined in each of the following \"auto offset\" methods implemented in `OffsetHelper` to allow a retirement within one transaction: - `autoOffsetPoolToken()` if the user already owns a Toucan pool token e.g., NCT, - `autoOffsetExactOutETH()` if the user would like to perform a retirement using native tokens e.g., MATIC, specifying the exact amount of TCO2s to retire (only on Polygon, not on Celo), - `autoOffsetExactInETH()` if the user would like to perform a retirement using native tokens, swapping all sent native tokens into TCO2s (only on Polygon, not on Celo), - `autoOffsetExactOutToken()` if the user would like to perform a retirement using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount of TCO2s to retire, - `autoOffsetExactInToken()` if the user would like to perform a retirement using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount of token to swap into TCO2s. In these methods, \"auto\" refers to the fact that these methods use `autoRedeem()` in order to automatically choose a TCO2 token corresponding to the oldest tokenized carbon project in the specfified token pool. There are no fees incurred by the user when using `autoRedeem()`, i.e., the user receives 1 TCO2 token for each pool token (BCT/NCT) redeemed. There are two `view` helper functions `calculateNeededETHAmount()` and `calculateNeededTokenAmount()` that should be called before using `autoOffsetExactOutETH()` and `autoOffsetExactOutToken()`, to determine how much native tokens e.g., MATIC, respectively how much of the ERC20 token must be sent to the `OffsetHelper` contract in order to retire the specified amount of carbon. The two `view` helper functions `calculateExpectedPoolTokenForETH()` and `calculateExpectedPoolTokenForToken()` can be used to calculate the expected amount of TCO2s that will be offset using functions `autoOffsetExactInETH()` and `autoOffsetExactInToken()`.", + "notice": "Helper functions that simplify the carbon offsetting (retirement) process. Retiring carbon tokens requires multiple steps and interactions with Toucan Protocol's main contracts: 1. Obtain a pool token e.g., NCT (by performing a token swap on a DEX). 2. Redeem the pool token for a TCO2 token. 3. Retire the TCO2 token. These steps are combined in each of the following \"auto offset\" methods implemented in `OffsetHelper` to allow a retirement within one transaction: - `autoOffsetPoolToken()` if the user already owns a Toucan pool token e.g., NCT, - `autoOffsetExactOutETH()` if the user would like to perform a retirement using native tokens e.g., MATIC, specifying the exact amount of TCO2s to retire (only on Polygon, not on Celo), - `autoOffsetExactInETH()` if the user would like to perform a retirement using native tokens, swapping all sent native tokens into TCO2s (only on Polygon, not on Celo), - `autoOffsetExactOutToken()` if the user would like to perform a retirement using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount of TCO2s to retire, - `autoOffsetExactInToken()` if the user would like to perform a retirement using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount of token to swap into TCO2s. In these methods, \"auto\" refers to the fact that these methods use `autoRedeem()` in order to automatically choose a TCO2 token corresponding to the oldest tokenized carbon project in the specfified token pool. There are no fees incurred by the user when using `autoRedeem()`, i.e., the user receives 1 TCO2 token for each pool token (BCT/NCT) redeemed. There are two `view` helper functions `calculateNeededETHAmount()` and `calculateNeededTokenAmount()` that should be called before using `autoOffsetExactOutETH()` and `autoOffsetExactOutToken()`, to determine how much native tokens e.g., MATIC, respectively how much of the ERC20 token must be sent to the `OffsetHelper` contract in order to retire the specified amount of carbon. The two `view` helper functions `calculateExpectedPoolTokenForETH()` and `calculateExpectedPoolTokenForToken()` can be used to calculate the expected amount of TCO2s that will be offset using functions `autoOffsetExactInETH()` and `autoOffsetExactInToken()`.", "version": 1 }, "storageLayout": { "storage": [ { - "astId": 138, - "contract": "contracts/OffsetHelper.sol:OffsetHelper", - "label": "_initialized", - "offset": 0, - "slot": "0", - "type": "t_uint8" - }, - { - "astId": 141, - "contract": "contracts/OffsetHelper.sol:OffsetHelper", - "label": "_initializing", - "offset": 1, - "slot": "0", - "type": "t_bool" - }, - { - "astId": 703, - "contract": "contracts/OffsetHelper.sol:OffsetHelper", - "label": "__gap", - "offset": 0, - "slot": "1", - "type": "t_array(t_uint256)50_storage" - }, - { - "astId": 10, + "astId": 2465, "contract": "contracts/OffsetHelper.sol:OffsetHelper", "label": "_owner", "offset": 0, - "slot": "51", + "slot": "0", "type": "t_address" }, { - "astId": 130, - "contract": "contracts/OffsetHelper.sol:OffsetHelper", - "label": "__gap", - "offset": 0, - "slot": "52", - "type": "t_array(t_uint256)49_storage" - }, - { - "astId": 3502, + "astId": 5229, "contract": "contracts/OffsetHelper.sol:OffsetHelper", "label": "eligibleSwapPaths", "offset": 0, - "slot": "101", + "slot": "1", "type": "t_mapping(t_address,t_array(t_address)dyn_storage)" }, { - "astId": 3507, + "astId": 5234, "contract": "contracts/OffsetHelper.sol:OffsetHelper", "label": "eligibleSwapPathsBySymbol", "offset": 0, - "slot": "102", + "slot": "2", "type": "t_mapping(t_string_memory_ptr,t_array(t_address)dyn_storage)" }, { - "astId": 3509, - "contract": "contracts/OffsetHelper.sol:OffsetHelper", - "label": "dexRouterAddress", - "offset": 0, - "slot": "103", - "type": "t_address" - }, - { - "astId": 3512, + "astId": 5237, "contract": "contracts/OffsetHelper.sol:OffsetHelper", "label": "poolAddresses", "offset": 0, - "slot": "104", + "slot": "3", "type": "t_array(t_address)dyn_storage" }, { - "astId": 3515, + "astId": 5240, "contract": "contracts/OffsetHelper.sol:OffsetHelper", "label": "tokenSymbolsForPaths", "offset": 0, - "slot": "105", + "slot": "4", "type": "t_array(t_string_storage)dyn_storage" }, { - "astId": 3519, + "astId": 5244, "contract": "contracts/OffsetHelper.sol:OffsetHelper", "label": "paths", "offset": 0, - "slot": "106", + "slot": "5", "type": "t_array(t_array(t_address)dyn_storage)dyn_storage" }, { - "astId": 3525, + "astId": 5246, "contract": "contracts/OffsetHelper.sol:OffsetHelper", - "label": "balances", + "label": "dexRouterAddress", "offset": 0, - "slot": "107", - "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + "slot": "6", + "type": "t_address" } ], "types": { @@ -1295,23 +1176,6 @@ "label": "string[]", "numberOfBytes": "32" }, - "t_array(t_uint256)49_storage": { - "base": "t_uint256", - "encoding": "inplace", - "label": "uint256[49]", - "numberOfBytes": "1568" - }, - "t_array(t_uint256)50_storage": { - "base": "t_uint256", - "encoding": "inplace", - "label": "uint256[50]", - "numberOfBytes": "1600" - }, - "t_bool": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - }, "t_mapping(t_address,t_array(t_address)dyn_storage)": { "encoding": "mapping", "key": "t_address", @@ -1319,20 +1183,6 @@ "numberOfBytes": "32", "value": "t_array(t_address)dyn_storage" }, - "t_mapping(t_address,t_mapping(t_address,t_uint256))": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => mapping(address => uint256))", - "numberOfBytes": "32", - "value": "t_mapping(t_address,t_uint256)" - }, - "t_mapping(t_address,t_uint256)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => uint256)", - "numberOfBytes": "32", - "value": "t_uint256" - }, "t_mapping(t_string_memory_ptr,t_array(t_address)dyn_storage)": { "encoding": "mapping", "key": "t_string_memory_ptr", @@ -1349,16 +1199,6 @@ "encoding": "bytes", "label": "string", "numberOfBytes": "32" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - }, - "t_uint8": { - "encoding": "inplace", - "label": "uint8", - "numberOfBytes": "1" } } } diff --git a/deployments/mumbai/solcInputs/75278ec65526f1e0033cc879f57dc68d.json b/deployments/mumbai/solcInputs/75278ec65526f1e0033cc879f57dc68d.json new file mode 100644 index 0000000..1869077 --- /dev/null +++ b/deployments/mumbai/solcInputs/75278ec65526f1e0033cc879f57dc68d.json @@ -0,0 +1,125 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822ProxiableUpgradeable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeaconUpgradeable {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeaconUpgradeable.sol\";\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/StorageSlotUpgradeable.sol\";\nimport \"../utils/Initializable.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967UpgradeUpgradeable is Initializable {\n function __ERC1967Upgrade_init() internal onlyInitializing {\n }\n\n function __ERC1967Upgrade_init_unchained() internal onlyInitializing {\n }\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(AddressUpgradeable.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n _functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Emitted when the beacon is upgraded.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(AddressUpgradeable.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\n }\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return AddressUpgradeable.verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Internal function that returns the initialized version. Returns `_initialized`\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Internal function that returns the initialized version. Returns `_initializing`\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../ERC1967/ERC1967UpgradeUpgradeable.sol\";\nimport \"./Initializable.sol\";\n\n/**\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\n *\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\n * `UUPSUpgradeable` with a custom implementation of upgrades.\n *\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\n *\n * _Available since v4.1._\n */\nabstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {\n function __UUPSUpgradeable_init() internal onlyInitializing {\n }\n\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\n }\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\n address private immutable __self = address(this);\n\n /**\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\n * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\n * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\n * fail.\n */\n modifier onlyProxy() {\n require(address(this) != __self, \"Function must be called through delegatecall\");\n require(_getImplementation() == __self, \"Function must be called through active proxy\");\n _;\n }\n\n /**\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\n * callable on the implementing contract but not through proxies.\n */\n modifier notDelegated() {\n require(address(this) == __self, \"UUPSUpgradeable: must not be called through delegatecall\");\n _;\n }\n\n /**\n * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\n */\n function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\n return _IMPLEMENTATION_SLOT;\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n */\n function upgradeTo(address newImplementation) external virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\n * encoded in `data`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n */\n function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, data, true);\n }\n\n /**\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\n * {upgradeTo} and {upgradeToAndCall}.\n *\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\n *\n * ```solidity\n * function _authorizeUpgrade(address) internal override onlyOwner {}\n * ```\n */\n function _authorizeUpgrade(address newImplementation) internal virtual;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlotUpgradeable {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol": { + "content": "pragma solidity >=0.6.2;\n\ninterface IUniswapV2Router01 {\n function factory() external pure returns (address);\n function WETH() external pure returns (address);\n\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint amountADesired,\n uint amountBDesired,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline\n ) external returns (uint amountA, uint amountB, uint liquidity);\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) external payable returns (uint amountToken, uint amountETH, uint liquidity);\n function removeLiquidity(\n address tokenA,\n address tokenB,\n uint liquidity,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline\n ) external returns (uint amountA, uint amountB);\n function removeLiquidityETH(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) external returns (uint amountToken, uint amountETH);\n function removeLiquidityWithPermit(\n address tokenA,\n address tokenB,\n uint liquidity,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline,\n bool approveMax, uint8 v, bytes32 r, bytes32 s\n ) external returns (uint amountA, uint amountB);\n function removeLiquidityETHWithPermit(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline,\n bool approveMax, uint8 v, bytes32 r, bytes32 s\n ) external returns (uint amountToken, uint amountETH);\n function swapExactTokensForTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external returns (uint[] memory amounts);\n function swapTokensForExactTokens(\n uint amountOut,\n uint amountInMax,\n address[] calldata path,\n address to,\n uint deadline\n ) external returns (uint[] memory amounts);\n function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)\n external\n payable\n returns (uint[] memory amounts);\n function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)\n external\n returns (uint[] memory amounts);\n function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)\n external\n returns (uint[] memory amounts);\n function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)\n external\n payable\n returns (uint[] memory amounts);\n\n function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);\n function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);\n function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);\n function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);\n function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);\n}\n" + }, + "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol": { + "content": "pragma solidity >=0.6.2;\n\nimport './IUniswapV2Router01.sol';\n\ninterface IUniswapV2Router02 is IUniswapV2Router01 {\n function removeLiquidityETHSupportingFeeOnTransferTokens(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) external returns (uint amountETH);\n function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline,\n bool approveMax, uint8 v, bytes32 r, bytes32 s\n ) external returns (uint amountETH);\n\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external payable;\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n}\n" + }, + "contracts/interfaces/IRetirementCertificates.sol": { + "content": "// SPDX-FileCopyrightText: 2021 Toucan Labs\n//\n// SPDX-License-Identifier: UNLICENSED\n\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\n\nimport \"./IToucanContractRegistry.sol\";\n\ninterface RetirementCertificates is IERC721Upgradeable {\n /// @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n function tokenURI(uint256 tokenId) external returns (string memory);\n\n /// @notice Update retirementMessage, beneficiary, and beneficiaryString of a NFT\n /// within 24h of creation. Empty values are ignored, ie., will not overwrite the\n /// existing stored values in the NFT.\n /// @param tokenId The id of the NFT to update\n /// @param beneficiary The new beneficiary to set in the NFT\n /// @param beneficiaryString The new beneficiaryString to set in the NFT\n /// @param retirementMessage The new retirementMessage to set in the NFT\n /// @dev The function can only be called by a the NFT owner\n function updateCertificate(\n uint256 tokenId,\n address beneficiary,\n string calldata beneficiaryString,\n string calldata retirementMessage\n ) external;\n}\n" + }, + "contracts/interfaces/IToucanCarbonOffsets.sol": { + "content": "// SPDX-FileCopyrightText: 2021 Toucan Labs\n//\n// SPDX-License-Identifier: UNLICENSED\n\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\n\nimport \"../types/CarbonProjectTypes.sol\";\nimport \"../types/CarbonProjectVintageTypes.sol\";\n\ninterface IToucanCarbonOffsets is IERC20Upgradeable, IERC721Receiver {\n function getGlobalProjectVintageIdentifiers()\n external\n view\n returns (string memory, string memory);\n\n function getAttributes()\n external\n view\n returns (ProjectData memory, VintageData memory);\n\n function getRemaining() external view returns (uint256 remaining);\n\n function getDepositCap() external view returns (uint256);\n\n function retire(uint256 amount) external;\n\n function retireFrom(address account, uint256 amount) external;\n\n function mintCertificateLegacy(\n string calldata retiringEntityString,\n address beneficiary,\n string calldata beneficiaryString,\n string calldata retirementMessage,\n uint256 amount\n ) external;\n\n function retireAndMintCertificate(\n string calldata retiringEntityString,\n address beneficiary,\n string calldata beneficiaryString,\n string calldata retirementMessage,\n uint256 amount\n ) external;\n}\n" + }, + "contracts/interfaces/IToucanContractRegistry.sol": { + "content": "// SPDX-FileCopyrightText: 2021 Toucan Labs\n//\n// SPDX-License-Identifier: UNLICENSED\n\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\npragma solidity ^0.8.0;\n\ninterface IToucanContractRegistry {\n function carbonOffsetBatchesAddress() external view returns (address);\n\n function carbonProjectsAddress() external view returns (address);\n\n function carbonProjectVintagesAddress() external view returns (address);\n\n function toucanCarbonOffsetsFactoryAddress()\n external\n view\n returns (address);\n\n function carbonOffsetBadgesAddress() external view returns (address);\n\n function checkERC20(address _address) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IToucanPoolToken.sol": { + "content": "// SPDX-FileCopyrightText: 2021 Toucan Labs\n//\n// SPDX-License-Identifier: UNLICENSED\n\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\ninterface IToucanPoolToken is IERC20Upgradeable {\n function deposit(address erc20Addr, uint256 amount) external;\n\n function checkEligible(address erc20Addr) external view returns (bool);\n\n function checkAttributeMatching(address erc20Addr)\n external\n view\n returns (bool);\n\n function calculateRedeemFees(\n address[] memory tco2s,\n uint256[] memory amounts\n ) external view returns (uint256);\n\n function redeemMany(address[] memory tco2s, uint256[] memory amounts)\n external;\n\n function redeemAuto(uint256 amount) external;\n\n function redeemAuto2(uint256 amount)\n external\n returns (address[] memory tco2s, uint256[] memory amounts);\n\n function getRemaining() external view returns (uint256);\n\n function getScoredTCO2s() external view returns (address[] memory);\n}\n" + }, + "contracts/OffsetHelper.sol": { + "content": "// SPDX-FileCopyrightText: 2022 Toucan Labs\n// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\";\nimport \"./OffsetHelperStorage.sol\";\nimport \"./interfaces/IToucanPoolToken.sol\";\nimport \"./interfaces/IToucanCarbonOffsets.sol\";\nimport \"./interfaces/IToucanContractRegistry.sol\";\n\n/**\n * @title Toucan Protocol Offset Helpers\n * @notice Helper functions that simplify the carbon offsetting (retirement)\n * process.\n *\n * Retiring carbon tokens requires multiple steps and interactions with\n * Toucan Protocol's main contracts:\n * 1. Obtain a pool token e.g., NCT (by performing a token\n * swap on a DEX).\n * 2. Redeem the pool token for a TCO2 token.\n * 3. Retire the TCO2 token.\n *\n * These steps are combined in each of the following \"auto offset\" methods\n * implemented in `OffsetHelper` to allow a retirement within one transaction:\n * - `autoOffsetPoolToken()` if the user already owns a Toucan pool\n * token e.g., NCT,\n * - `autoOffsetExactOutETH()` if the user would like to perform a retirement\n * using native tokens e.g., MATIC, specifying the exact amount of TCO2s to retire (only on Polygon, not on Celo),\n * - `autoOffsetExactInETH()` if the user would like to perform a retirement\n * using native tokens, swapping all sent native tokens into TCO2s (only on Polygon, not on Celo),\n * - `autoOffsetExactOutToken()` if the user would like to perform a retirement\n * using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount\n * of TCO2s to retire,\n * - `autoOffsetExactInToken()` if the user would like to perform a retirement\n * using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount\n * of token to swap into TCO2s.\n *\n * In these methods, \"auto\" refers to the fact that these methods use\n * `autoRedeem()` in order to automatically choose a TCO2 token corresponding\n * to the oldest tokenized carbon project in the specfified token pool.\n * There are no fees incurred by the user when using `autoRedeem()`, i.e., the\n * user receives 1 TCO2 token for each pool token (BCT/NCT) redeemed.\n *\n * There are two `view` helper functions `calculateNeededETHAmount()` and\n * `calculateNeededTokenAmount()` that should be called before using\n * `autoOffsetExactOutETH()` and `autoOffsetExactOutToken()`, to determine how\n * much native tokens e.g., MATIC, respectively how much of the ERC20 token must be sent to the\n * `OffsetHelper` contract in order to retire the specified amount of carbon.\n *\n * The two `view` helper functions `calculateExpectedPoolTokenForETH()` and\n * `calculateExpectedPoolTokenForToken()` can be used to calculate the\n * expected amount of TCO2s that will be offset using functions\n * `autoOffsetExactInETH()` and `autoOffsetExactInToken()`.\n */\ncontract OffsetHelper is OffsetHelperStorage {\n using SafeERC20 for IERC20;\n // As Celo allows to pay the gas fees with other tokens than the native token,\n // it's not possible ot use the swapETH (swap native tokens) functions.\n uint256 private constant CELO_MAINNET_CHAINID = 42220;\n uint256 private constant ALFAJORES_MAINNET_CHAINID = 44787;\n\n /**\n * @notice Emitted upon successful redemption of TCO2 tokens from a Toucan\n * pool token e.g., NCT.\n *\n * @param sender The sender of the transaction\n * @param poolToken The address of the pool token used in the\n * redemption, e.g., NCT\n * @param tco2s An array of the TCO2 addresses that were redeemed\n * @param amounts An array of the amounts of each TCO2 that were redeemed\n */\n event Redeemed(\n address sender,\n address poolToken,\n address[] tco2s,\n uint256[] amounts\n );\n\n modifier onlyRedeemable(address _token) {\n require(isRedeemable(_token), \"Token not redeemable.\");\n\n _;\n }\n\n modifier onlySwappable(address _token) {\n require(isSwappable(_token), \"Path doesn't yet exist.\");\n\n _;\n }\n\n modifier isNotCelo() {\n require(\n block.chainid != CELO_MAINNET_CHAINID &&\n block.chainid != ALFAJORES_MAINNET_CHAINID,\n \"The function is not available on Celo.\"\n );\n\n _;\n }\n\n /**\n * @notice Contract constructor. Should specify arrays of ERC20 symbols and\n * addresses that can used by the contract.\n *\n * @dev See `isEligible()` for a list of tokens that can be used in the\n * contract. These can be modified after deployment by the contract owner\n * using `setEligibleTokenAddress()` and `deleteEligibleTokenAddress()`.\n *\n * @param _poolAddresses A list of pool token addresses.\n * @param _tokenSymbolsForPaths An array of symbols of the token the user want to retire carbon credits for\n * @param _paths An array of arrays of addresses to describe the path needed to swap form the baseToken to the pool Token\n * to the provided token symbols.\n */\n constructor(\n address[] memory _poolAddresses,\n string[] memory _tokenSymbolsForPaths,\n address[][] memory _paths,\n address _dexRouterAddress\n ) {\n poolAddresses = _poolAddresses;\n tokenSymbolsForPaths = _tokenSymbolsForPaths;\n paths = _paths;\n dexRouterAddress = _dexRouterAddress;\n\n uint256 eligibleSwapPathsBySymbolLen = _tokenSymbolsForPaths.length;\n for (uint256 i; i < eligibleSwapPathsBySymbolLen; i++) {\n eligibleSwapPaths[_paths[i][0]] = _paths[i];\n eligibleSwapPathsBySymbol[_tokenSymbolsForPaths[i]] = _paths[i];\n }\n }\n\n // The receive and fallback method are needed to fix the situation where transfering dust native tokens\n // in the native tokens to token swap fails\n receive() external payable {}\n\n // ----------------------------------------\n // Public functions\n // ----------------------------------------\n\n /**\n * @notice Retire carbon credits using the oldest TCO2\n * tokens available from the specified Toucan token pool by sending ERC20\n * tokens (cUSD, USDC, WETH, WMATIC). Use `calculateNeededTokenAmount` first in\n * order to find out how much of the ERC20 token is required to retire the\n * specified quantity of TCO2.\n *\n * This function:\n * 1. Swaps the ERC20 token sent to the contract for the specified pool token.\n * 2. Redeems the pool token for the oldest TCO2 tokens available.\n * 3. Retires the TCO2 tokens.\n *\n * Note: The client must approve the ERC20 token that is sent to the contract.\n *\n * @dev When automatically redeeming pool tokens for the oldest ones\n * TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool\n * token.\n *\n * @param _fromToken The address of the ERC20 token that the user sends\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\n * @param _poolToken The address of the pool token that the\n * user wants to use, e.g., NCT\n * @param _amountToOffset The amount of TCO2 to offset\n *\n * @return tco2s An array of the TCO2 addresses that were redeemed\n * @return amounts An array of the amounts of each TCO2 that were redeemed\n */\n function autoOffsetExactOutToken(\n address _fromToken,\n address _poolToken,\n uint256 _amountToOffset\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\n // swap input token for BCT / NCT\n swapExactOutToken(_fromToken, _poolToken, _amountToOffset);\n\n // redeem BCT / NCT for TCO2s\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\n\n // retire the TCO2s to achieve offset\n autoRetire(tco2s, amounts);\n }\n\n /**\n * @notice Retire carbon credits using the oldest TCO2\n * tokens available from the specified Toucan token pool by sending ERC20\n * tokens (cUSD, USDC, WETH, WMATIC). All provided token is consumed for\n * offsetting. Use `calculateExpectedPoolTokenForToken()` to calculate the expected amount\n * of Pool token that can be acquired by swapping the provided amount of ERC20 token.\n *\n * This function:\n * 1. Swaps the ERC20 token sent to the contract for the specified pool token.\n * 2. Redeems the pool token for the oldest TCO2 tokens available.\n * 3. Retires the TCO2 tokens.\n *\n * Note: The client must approve the ERC20 token that is sent to the contract.\n *\n * @dev When automatically redeeming pool tokens for the oldest ones\n * TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool\n * token.\n *\n * @param _fromToken The address of the ERC20 token that the user sends\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\n * @param _poolToken The address of the pool token that the\n * user wants to use, e.g., NCT\n * @param _amountToSwap The amount of ERC20 token to swap into Toucan pool\n * token. Full amount will be used for offsetting.\n *\n * @return tco2s An array of the TCO2 addresses that were redeemed\n * @return amounts An array of the amounts of each TCO2 that were redeemed\n */\n function autoOffsetExactInToken(\n address _fromToken,\n address _poolToken,\n uint256 _amountToSwap\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\n // swap input token for BCT / NCT\n uint256 amountToOffset = swapExactInToken(\n _fromToken,\n _poolToken,\n _amountToSwap\n );\n\n // redeem BCT / NCT for TCO2s\n (tco2s, amounts) = autoRedeem(_poolToken, amountToOffset);\n\n // retire the TCO2s to achieve offset\n autoRetire(tco2s, amounts);\n }\n\n /**\n * @notice Retire carbon credits using the oldest TCO2\n * tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC.\n * Use `calculateNeededETHAmount()` first in order to find out how much\n * native tokens are required to retire the specified quantity of TCO2.\n *\n * This function:\n * 1. Swaps the Matic sent to the contract for the specified pool token.\n * 2. Redeems the pool token for the oldest TCO2 tokens available.\n * 3. Retires the TCO2 tokens.\n *\n * @dev If the user sends too much native tokens , the leftover amount will be sent back\n * to the user. This function is only available on Polygon, not on Celo.\n *\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n * @param _amountToOffset The amount of TCO2 to offset.\n *\n * @return tco2s An array of the TCO2 addresses that were redeemed\n * @return amounts An array of the amounts of each TCO2 that were redeemed\n */\n function autoOffsetExactOutETH(\n address _poolToken,\n uint256 _amountToOffset\n )\n public\n payable\n isNotCelo\n returns (address[] memory tco2s, uint256[] memory amounts)\n {\n // swap native tokens for BCT / NCT\n swapExactOutETH(_poolToken, _amountToOffset);\n\n // redeem BCT / NCT for TCO2s\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\n\n // retire the TCO2s to achieve offset\n autoRetire(tco2s, amounts);\n }\n\n /**\n * @notice Retire carbon credits using the oldest TCO2\n * tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC.\n * All provided native tokens is consumed for offsetting.\n * Use `calculateExpectedPoolTokenForETH()` to calculate the expected amount of\n * Pool token that can be acquired by swapping the provided amount of native tokens e.g., MATIC.\n *\n * This function:\n * 1. Swaps the Matic sent to the contract for the specified pool token.\n * 2. Redeems the pool token for the oldest TCO2 tokens available.\n * 3. Retires the TCO2 tokens.\n *\n * @dev This function is only available on Polygon, not on Celo.\n *\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n *\n * @return tco2s An array of the TCO2 addresses that were redeemed\n * @return amounts An array of the amounts of each TCO2 that were redeemed\n */\n function autoOffsetExactInETH(\n address _poolToken\n )\n public\n payable\n isNotCelo\n returns (address[] memory tco2s, uint256[] memory amounts)\n {\n // swap native tokens for BCT / NCT\n uint256 amountToOffset = swapExactInETH(_poolToken);\n\n // redeem BCT / NCT for TCO2s\n (tco2s, amounts) = autoRedeem(_poolToken, amountToOffset);\n\n // retire the TCO2s to achieve offset\n autoRetire(tco2s, amounts);\n }\n\n /**\n * @notice Retire carbon credits using the oldest TCO2\n * tokens available by sending pool tokens, e.g., NCT.\n *\n * This function:\n * 1. Redeems the pool token for the oldest TCO2 tokens available.\n * 2. Retires the TCO2 tokens.\n *\n * Note: The client must approve the pool token that is sent.\n *\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n * @param _amountToOffset The amount of TCO2 to offset.\n *\n * @return tco2s An array of the TCO2 addresses that were redeemed\n * @return amounts An array of the amounts of each TCO2 that were redeemed\n */\n function autoOffsetPoolToken(\n address _poolToken,\n uint256 _amountToOffset\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\n // deposit pool token from user to this contract\n IERC20(_poolToken).safeTransferFrom(\n msg.sender,\n address(this),\n _amountToOffset\n );\n\n // redeem BCT / NCT for TCO2s\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\n\n // retire the TCO2s to achieve offset\n autoRetire(tco2s, amounts);\n }\n\n /**\n * @notice Redeems the specified amount of NCT / BCT for TCO2.\n * @dev Needs to be approved on the client side\n * @param _fromToken Could be the address of NCT\n * @param _amount Amount to redeem\n * @return tco2s An array of the TCO2 addresses that were redeemed\n * @return amounts An array of the amounts of each TCO2 that were redeemed\n */\n function autoRedeem(\n address _fromToken,\n uint256 _amount\n )\n public\n onlyRedeemable(_fromToken)\n returns (address[] memory tco2s, uint256[] memory amounts)\n {\n require(\n IERC20(_fromToken).balanceOf(address(this)) >= _amount,\n \"Insufficient NCT/BCT balance\"\n );\n\n // instantiate pool token (NCT)\n IToucanPoolToken PoolTokenImplementation = IToucanPoolToken(_fromToken);\n\n // auto redeem pool token for TCO2; will transfer automatically picked TCO2 to this contract\n (tco2s, amounts) = PoolTokenImplementation.redeemAuto2(_amount);\n\n emit Redeemed(msg.sender, _fromToken, tco2s, amounts);\n }\n\n /**\n * @notice Retire the specified TCO2 tokens.\n * @param _tco2s The addresses of the TCO2s to retire\n * @param _amounts The amounts to retire from each of the corresponding\n * TCO2 addresses\n */\n function autoRetire(\n address[] memory _tco2s,\n uint256[] memory _amounts\n ) public {\n uint256 tco2sLen = _tco2s.length;\n require(tco2sLen != 0, \"Array empty\");\n\n require(tco2sLen == _amounts.length, \"Arrays unequal\");\n\n for (uint i = 0; i < tco2sLen; i++) {\n if (_amounts[i] == 0) {\n continue;\n }\n require(\n IERC20(_tco2s[i]).balanceOf(address(this)) >= _amounts[i],\n \"Insufficient TCO2 balance\"\n );\n\n IToucanCarbonOffsets(_tco2s[i]).retire(_amounts[i]);\n }\n }\n\n /**\n * @notice Swap eligible ERC20 tokens for pool tokens (BCT/NCT) on SushiSwap\n * @dev Needs to be approved on the client side\n * @param _fromToken The address of the ERC20 token used for the swap\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n * @param _toAmount The required amount of the pool token (NCT/BCT)\n */\n function swapExactOutToken(\n address _fromToken,\n address _poolToken,\n uint256 _toAmount\n ) public onlySwappable(_fromToken) onlyRedeemable(_poolToken) {\n // calculate path & amounts\n (\n address[] memory path,\n uint256[] memory expAmounts\n ) = calculateExactOutSwap(_fromToken, _poolToken, _toAmount);\n uint256 amountIn = expAmounts[0];\n\n // transfer tokens\n IERC20(_fromToken).safeTransferFrom(\n msg.sender,\n address(this),\n amountIn\n );\n\n // approve router\n IERC20(_fromToken).approve(dexRouterAddress, amountIn);\n\n // swap\n uint256[] memory amounts = dexRouter().swapTokensForExactTokens(\n _toAmount,\n amountIn, // max. input amount\n path,\n address(this),\n block.timestamp\n );\n\n // remove remaining approval if less input token was consumed\n if (amounts[0] < amountIn) {\n IERC20(_fromToken).approve(dexRouterAddress, 0);\n }\n }\n\n /**\n * @notice Swap eligible ERC20 tokens for pool tokens (BCT/NCT) on\n * SushiSwap. All provided ERC20 tokens will be swapped.\n * @dev Needs to be approved on the client side.\n * @param _fromToken The address of the ERC20 token used for the swap\n * @param _poolToken The address of the pool token to swap for,\n * @param _fromAmount The amount of ERC20 token to swap\n * e.g., NCT\n * @return amountOut Resulting amount of pool token that got acquired for the\n * swapped ERC20 tokens.\n */\n function swapExactInToken(\n address _fromToken,\n address _poolToken,\n uint256 _fromAmount\n )\n public\n onlySwappable(_fromToken)\n onlyRedeemable(_poolToken)\n returns (uint256 amountOut)\n {\n // calculate path & amounts\n address[] memory path = generatePath(_fromToken, _poolToken);\n\n uint256 len = path.length;\n\n // transfer tokens\n IERC20(_fromToken).safeTransferFrom(\n msg.sender,\n address(this),\n _fromAmount\n );\n\n // approve router\n IERC20(_fromToken).safeApprove(dexRouterAddress, _fromAmount);\n\n // swap\n uint256[] memory amounts = dexRouter().swapExactTokensForTokens(\n _fromAmount,\n 0, // min. output amount\n path,\n address(this),\n block.timestamp\n );\n amountOut = amounts[len - 1];\n }\n\n /**\n * @notice Swap native tokens e.g., MATIC for pool tokens (BCT/NCT) on SushiSwap.\n * Remaining native tokens that was not consumed by the swap is returned.\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n * @param _toAmount The required amount of the pool token (NCT/BCT)\n */\n function swapExactOutETH(\n address _poolToken,\n uint256 _toAmount\n ) public payable isNotCelo onlyRedeemable(_poolToken) {\n // create path & amounts\n // wrap the native token\n address fromToken = eligibleSwapPathsBySymbol[\"WMATIC\"][0];\n address[] memory path = generatePath(fromToken, _poolToken);\n\n // swap\n uint256[] memory amounts = dexRouter().swapETHForExactTokens{\n value: msg.value\n }(_toAmount, path, address(this), block.timestamp);\n\n // send surplus back\n if (msg.value > amounts[0]) {\n uint256 leftoverETH = msg.value - amounts[0];\n (bool success, ) = msg.sender.call{value: leftoverETH}(\n new bytes(0)\n );\n\n require(success, \"Failed to send surplus back\");\n }\n }\n\n /**\n * @notice Swap native tokens e.g., MATIC for pool tokens (BCT/NCT) on SushiSwap. All\n * provided native tokens will be swapped.\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n * @return amountOut Resulting amount of pool token that got acquired for the\n * swapped native tokens .\n */\n function swapExactInETH(\n address _poolToken\n )\n public\n payable\n isNotCelo\n onlyRedeemable(_poolToken)\n returns (uint256 amountOut)\n {\n // create path & amounts\n uint256 fromAmount = msg.value;\n // wrap the native token\n address fromToken = eligibleSwapPathsBySymbol[\"WMATIC\"][0];\n address[] memory path = generatePath(fromToken, _poolToken);\n\n uint256 len = path.length;\n\n // swap\n uint256[] memory amounts = dexRouter().swapExactETHForTokens{\n value: fromAmount\n }(0, path, address(this), block.timestamp);\n amountOut = amounts[len - 1];\n }\n\n // ----------------------------------------\n // Public view functions\n // ----------------------------------------\n\n /**\n * @notice Return how much of the specified ERC20 token is required in\n * order to swap for the desired amount of a pool token, for\n * example, e.g., NCT.\n *\n * @param _fromToken The address of the ERC20 token used for the swap\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n * @param _toAmount The desired amount of pool token to receive\n * @return amountIn The amount of the ERC20 token required in order to\n * swap for the specified amount of the pool token\n */\n function calculateNeededTokenAmount(\n address _fromToken,\n address _poolToken,\n uint256 _toAmount\n )\n public\n view\n onlySwappable(_fromToken)\n onlyRedeemable(_poolToken)\n returns (uint256 amountIn)\n {\n (, uint256[] memory amounts) = calculateExactOutSwap(\n _fromToken,\n _poolToken,\n _toAmount\n );\n amountIn = amounts[0];\n }\n\n /**\n * @notice Return how much native tokens e.g, MATIC is required in order to swap for the\n * desired amount of a pool token, e.g., NCT.\n * @param _poolToken The address of the pool token to swap for, for\n * example, NCT\n * @param _toAmount The desired amount of pool token to receive\n * @return amountIn The amount of native tokens required in order to swap for\n * the specified amount of the pool token\n */\n function calculateNeededETHAmount(\n address _poolToken,\n uint256 _toAmount\n ) public view onlyRedeemable(_poolToken) returns (uint256 amountIn) {\n address fromToken = eligibleSwapPathsBySymbol[\"WMATIC\"][0];\n (, uint256[] memory amounts) = calculateExactOutSwap(\n fromToken,\n _poolToken,\n _toAmount\n );\n amountIn = amounts[0];\n }\n\n /**\n * @notice Calculates the expected amount of pool token that can be\n * acquired by swapping the provided amount of ERC20 token.\n *\n * @param _fromToken The address of the ERC20 token used for the swap\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n * @param _fromAmount The amount of ERC20 token to swap\n * @return amountOut The expected amount of Pool token that can be acquired\n */\n function calculateExpectedPoolTokenForToken(\n address _fromToken,\n address _poolToken,\n uint256 _fromAmount\n )\n public\n view\n onlySwappable(_fromToken)\n onlyRedeemable(_poolToken)\n returns (uint256 amountOut)\n {\n (, uint256[] memory amounts) = calculateExactInSwap(\n _fromToken,\n _poolToken,\n _fromAmount\n );\n amountOut = amounts[amounts.length - 1];\n }\n\n /**\n * @notice Calculates the expected amount of pool token that can be\n * acquired by swapping the provided amount of native tokens e.g., MATIC.\n *\n * @param _fromTokenAmount The amount of native tokens to swap\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n * @return amountOut The expected amount of Pool token that can be acquired\n */\n function calculateExpectedPoolTokenForETH(\n address _poolToken,\n uint256 _fromTokenAmount\n )\n public\n view\n isNotCelo\n onlyRedeemable(_poolToken)\n returns (uint256 amountOut)\n {\n address fromToken = eligibleSwapPathsBySymbol[\"WMATIC\"][0];\n (, uint256[] memory amounts) = calculateExactInSwap(\n fromToken,\n _poolToken,\n _fromTokenAmount\n );\n amountOut = amounts[amounts.length - 1];\n }\n\n // ----------------------------------------\n // Internal functions\n // ----------------------------------------\n\n function calculateExactOutSwap(\n address _fromToken,\n address _poolToken,\n uint256 _toAmount\n ) internal view returns (address[] memory path, uint256[] memory amounts) {\n // create path & calculate amounts\n path = generatePath(_fromToken, _poolToken);\n uint256 len = path.length;\n\n amounts = dexRouter().getAmountsIn(_toAmount, path);\n\n // sanity check arrays\n require(len == amounts.length, \"Arrays unequal\");\n require(_toAmount == amounts[len - 1], \"Output amount mismatch\");\n }\n\n function calculateExactInSwap(\n address _fromToken,\n address _poolToken,\n uint256 _fromAmount\n ) internal view returns (address[] memory path, uint256[] memory amounts) {\n // create path & calculate amounts\n path = generatePath(_fromToken, _poolToken);\n uint256 len = path.length;\n\n amounts = dexRouter().getAmountsOut(_fromAmount, path);\n\n // sanity check arrays\n require(len == amounts.length, \"Arrays unequal\");\n require(_fromAmount == amounts[0], \"Input amount mismatch\");\n }\n\n /**\n * @notice Show all pool token addresses that can be used to retired.\n * @param _fromToken a list of token symbols that can be retired.\n * @param _toToken a list of token symbols that can be retired.\n */\n function generatePath(\n address _fromToken,\n address _toToken\n ) internal view returns (address[] memory path) {\n uint256 len = eligibleSwapPaths[_fromToken].length;\n if (len == 1) {\n path = new address[](2);\n path[0] = _fromToken;\n path[1] = _toToken;\n return path;\n }\n if (len == 2) {\n path = new address[](3);\n path[0] = _fromToken;\n path[1] = eligibleSwapPaths[_fromToken][1];\n path[2] = _toToken;\n return path;\n }\n if (len == 3) {\n path = new address[](3);\n path[0] = _fromToken;\n path[1] = eligibleSwapPaths[_fromToken][1];\n path[2] = eligibleSwapPaths[_fromToken][2];\n path[3] = _toToken;\n return path;\n } else {\n path = new address[](4);\n path[0] = _fromToken;\n path[1] = eligibleSwapPaths[_fromToken][1];\n path[2] = eligibleSwapPaths[_fromToken][2];\n path[3] = eligibleSwapPaths[_fromToken][3];\n path[4] = _toToken;\n return path;\n }\n }\n\n function dexRouter() internal view returns (IUniswapV2Router02) {\n return IUniswapV2Router02(dexRouterAddress);\n }\n\n // ----------------------------------------\n // Private functions\n // ----------------------------------------\n\n /**\n * @notice Checks whether an address is a pool token address\n * @param _erc20Address address of token to be checked\n * @return True if the address is a pool token address\n */\n function isRedeemable(address _erc20Address) private view returns (bool) {\n for (uint i = 0; i < poolAddresses.length; i++) {\n if (poolAddresses[i] == _erc20Address) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * @notice Checks whether an address can be used in a token swap\n * @param _erc20Address address of token to be checked\n * @return True if the specified address can be used in a swap\n */\n function isSwappable(address _erc20Address) private view returns (bool) {\n for (uint i = 0; i < paths.length; i++) {\n if (paths[i][0] == _erc20Address) {\n return true;\n }\n }\n\n return false;\n }\n\n // ----------------------------------------\n // Admin methods\n // ----------------------------------------\n\n /**\n * @notice Checks if ERC20 Token is eligible for Offsetting.\n * @param _erc20Address The address of the ERC20 token that the user sends\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\n * @return _path Returns the path of the token to be exchanged\n */\n\n function isERC20AddressEligible(\n address _erc20Address\n ) public view returns (address[] memory _path) {\n _path = eligibleSwapPaths[_erc20Address];\n }\n\n /**\n * @notice Change or add eligible paths and their addresses.\n * @param _tokenSymbol The symbol of the token to add\n * @param _path The path of the path to add\n */\n function addPath(\n string memory _tokenSymbol,\n address[] memory _path\n ) public virtual onlyOwner {\n eligibleSwapPaths[_path[0]] = _path;\n eligibleSwapPathsBySymbol[_tokenSymbol] = _path;\n tokenSymbolsForPaths.push(_tokenSymbol);\n }\n\n /**\n * @notice Delete eligible tokens stored in the contract.\n * @param _tokenSymbol The symbol of the path to remove\n */\n function removePath(string memory _tokenSymbol) public virtual onlyOwner {\n delete eligibleSwapPaths[eligibleSwapPathsBySymbol[_tokenSymbol][0]];\n delete eligibleSwapPathsBySymbol[_tokenSymbol];\n }\n\n /**\n * @notice Cheks if Pool Token is eligible for Offsetting.\n * @param _poolToken The addresses of the pool token to redeem\n * @return _isEligible Returns if token can be redeemed\n */\n\n function isPoolAddressEligible(\n address _poolToken\n ) public view returns (bool _isEligible) {\n _isEligible = isRedeemable(_poolToken);\n }\n\n /**\n * @notice Change or add pool token addresses.\n * @param _poolToken The address of the pool token to add\n */\n function addPoolToken(address _poolToken) public virtual onlyOwner {\n poolAddresses.push(_poolToken);\n }\n\n /**\n * @notice Delete eligible pool token addresses stored in the contract.\n * @param _poolToken The address of the pool token to remove\n */\n function removePoolToken(address _poolToken) public virtual onlyOwner {\n for (uint256 i; i < poolAddresses.length; i++) {\n if (poolAddresses[i] == _poolToken) {\n poolAddresses[i] = poolAddresses[poolAddresses.length - 1];\n poolAddresses.pop();\n break;\n }\n }\n }\n}\n" + }, + "contracts/OffsetHelperStorage.sol": { + "content": "// SPDX-FileCopyrightText: 2022 Toucan Labs\n//\n// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract OffsetHelperStorage is Ownable {\n // token symbol => token address\n mapping(address => address[]) public eligibleSwapPaths;\n mapping(string => address[]) public eligibleSwapPathsBySymbol;\n\n address[] public poolAddresses;\n string[] public tokenSymbolsForPaths;\n address[][] public paths;\n address public dexRouterAddress;\n}\n" + }, + "contracts/types/CarbonProjectTypes.sol": { + "content": "// SPDX-FileCopyrightText: 2021 Toucan Labs\n//\n// SPDX-License-Identifier: UNLICENSED\n\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\n\npragma solidity >=0.8.4 <0.9.0;\n\n/// @dev CarbonProject related data and attributes\nstruct ProjectData {\n string projectId;\n string standard;\n string methodology;\n string region;\n string storageMethod;\n string method;\n string emissionType;\n string category;\n string uri;\n address controller;\n}\n" + }, + "contracts/types/CarbonProjectVintageTypes.sol": { + "content": "// SPDX-FileCopyrightText: 2021 Toucan Labs\n//\n// SPDX-License-Identifier: UNLICENSED\n\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\n\npragma solidity >=0.8.4 <0.9.0;\n\nstruct VintageData {\n /// @dev A human-readable string which differentiates this from other vintages in\n /// the same project, and helps build the corresponding TCO2 name and symbol.\n string name;\n uint64 startTime; // UNIX timestamp\n uint64 endTime; // UNIX timestamp\n uint256 projectTokenId;\n uint64 totalVintageQuantity;\n bool isCorsiaCompliant;\n bool isCCPcompliant;\n string coBenefits;\n string correspAdjustment;\n string additionalCertification;\n string uri;\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/deployments/polygon/OffsetHelper.json b/deployments/polygon/OffsetHelper.json index f09e542..04a69f2 100644 --- a/deployments/polygon/OffsetHelper.json +++ b/deployments/polygon/OffsetHelper.json @@ -1,5 +1,5 @@ { - "address": "0x2647768D46Fe7c9A1b4606b3607a13C72a0cc086", + "address": "0x7cB7C0484d4F2324F51d81E2368823c20AEf8072", "abi": [ { "inputs": [ @@ -27,19 +27,6 @@ "stateMutability": "nonpayable", "type": "constructor" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -90,10 +77,6 @@ "name": "Redeemed", "type": "event" }, - { - "stateMutability": "payable", - "type": "fallback" - }, { "inputs": [ { @@ -322,30 +305,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "balances", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -452,24 +411,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "_erc20Addr", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "deposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [], "name": "dexRouterAddress", @@ -531,13 +472,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -786,58 +720,54 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "_erc20Addr", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "stateMutability": "payable", "type": "receive" } ], - "transactionHash": "0x0758b263c72c52fc9ab64f1f6f24699aa7cd764036baf7b4010a1b6b79cc6f1d", + "transactionHash": "0x9051f6eb657e06beb19dc253f491562e3d957832c4f2810c06eab880d4d45773", "receipt": { "to": null, - "from": "0x101b4C436df747B24D17ce43146Da52fa6006C36", - "contractAddress": "0x2647768D46Fe7c9A1b4606b3607a13C72a0cc086", - "transactionIndex": 144, - "gasUsed": "3996079", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000008000000000000000000000000000000000000000000000000000080000800000000000400000000100000000000000000000000000000000000000000000000000000000000080000020000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000004000000000000000000001000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000000000000100000", - "blockHash": "0x2c88de092f8b0a931b8a26b53ffb24519869761e5766d2947f300c749ee5f02f", - "transactionHash": "0x0758b263c72c52fc9ab64f1f6f24699aa7cd764036baf7b4010a1b6b79cc6f1d", + "from": "0xaEb6EDa99c37589667e4dEd9e1081A93307Ecc7A", + "contractAddress": "0x7cB7C0484d4F2324F51d81E2368823c20AEf8072", + "transactionIndex": 24, + "gasUsed": "3721313", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000080000000000000000000000000000008000000000000000000000000400000000000300000000000000000000800001000000000000000100000000000000000000020000000000000000000800000000000000080080000000000000400040000000040000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000004000000000000000000001000000000000000000000000000000120000000020000000000000010000000000000000000000000000000000000000000000100000", + "blockHash": "0xc6519106674de90228d5b00c218ea1ae286b696341a37bfedbfd1f4001b4b941", + "transactionHash": "0x9051f6eb657e06beb19dc253f491562e3d957832c4f2810c06eab880d4d45773", "logs": [ { - "transactionIndex": 144, - "blockNumber": 47453936, - "transactionHash": "0x0758b263c72c52fc9ab64f1f6f24699aa7cd764036baf7b4010a1b6b79cc6f1d", + "transactionIndex": 24, + "blockNumber": 48844755, + "transactionHash": "0x9051f6eb657e06beb19dc253f491562e3d957832c4f2810c06eab880d4d45773", + "address": "0x7cB7C0484d4F2324F51d81E2368823c20AEf8072", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000aeb6eda99c37589667e4ded9e1081a93307ecc7a" + ], + "data": "0x", + "logIndex": 474, + "blockHash": "0xc6519106674de90228d5b00c218ea1ae286b696341a37bfedbfd1f4001b4b941" + }, + { + "transactionIndex": 24, + "blockNumber": 48844755, + "transactionHash": "0x9051f6eb657e06beb19dc253f491562e3d957832c4f2810c06eab880d4d45773", "address": "0x0000000000000000000000000000000000001010", "topics": [ "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", "0x0000000000000000000000000000000000000000000000000000000000001010", - "0x000000000000000000000000101b4c436df747b24d17ce43146da52fa6006c36", - "0x0000000000000000000000007c7379531b2aee82e4ca06d4175d13b9cbeafd49" + "0x000000000000000000000000aeb6eda99c37589667e4ded9e1081a93307ecc7a", + "0x0000000000000000000000009ead03f7136fc6b4bdb0780b00a1c14ae5a8b6d0" ], - "data": "0x000000000000000000000000000000000000000000000000011af019a4ad43de0000000000000000000000000000000000000000000000011b319942ba837a2f0000000000000000000000000000000000000000000255b6c29275def3eb25750000000000000000000000000000000000000000000000011a16a92915d636510000000000000000000000000000000000000000000255b6c3ad65f898986953", - "logIndex": 652, - "blockHash": "0x2c88de092f8b0a931b8a26b53ffb24519869761e5766d2947f300c749ee5f02f" + "data": "0x000000000000000000000000000000000000000000000000019640eb2a92331c00000000000000000000000000000000000000000000000641593c89d84c06e900000000000000000000000000000000000000000000024f5a99338099dc9e0b0000000000000000000000000000000000000000000000063fc2fb9eadb9d3cd00000000000000000000000000000000000000000000024f5c2f746bc46ed127", + "logIndex": 475, + "blockHash": "0xc6519106674de90228d5b00c218ea1ae286b696341a37bfedbfd1f4001b4b941" } ], - "blockNumber": 47453936, - "cumulativeGasUsed": "26862822", + "blockNumber": 48844755, + "cumulativeGasUsed": "9015045", "status": 1, "byzantium": true }, @@ -866,17 +796,17 @@ ], "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506" ], - "numDeployments": 6, - "solcInputHash": "9768af37541e90e4200434e6de116099", - "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_poolAddresses\",\"type\":\"address[]\"},{\"internalType\":\"string[]\",\"name\":\"_tokenSymbolsForPaths\",\"type\":\"string[]\"},{\"internalType\":\"address[][]\",\"name\":\"_paths\",\"type\":\"address[][]\"},{\"internalType\":\"address\",\"name\":\"_dexRouterAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"poolToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"Redeemed\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_tokenSymbol\",\"type\":\"string\"},{\"internalType\":\"address[]\",\"name\":\"_path\",\"type\":\"address[]\"}],\"name\":\"addPath\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"addPoolToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"autoOffsetExactInETH\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountToSwap\",\"type\":\"uint256\"}],\"name\":\"autoOffsetExactInToken\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountToOffset\",\"type\":\"uint256\"}],\"name\":\"autoOffsetExactOutETH\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountToOffset\",\"type\":\"uint256\"}],\"name\":\"autoOffsetExactOutToken\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountToOffset\",\"type\":\"uint256\"}],\"name\":\"autoOffsetPoolToken\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"autoRedeem\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_amounts\",\"type\":\"uint256[]\"}],\"name\":\"autoRetire\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"balances\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fromTokenAmount\",\"type\":\"uint256\"}],\"name\":\"calculateExpectedPoolTokenForETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fromAmount\",\"type\":\"uint256\"}],\"name\":\"calculateExpectedPoolTokenForToken\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAmount\",\"type\":\"uint256\"}],\"name\":\"calculateNeededETHAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAmount\",\"type\":\"uint256\"}],\"name\":\"calculateNeededTokenAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_erc20Addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"dexRouterAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"eligibleSwapPaths\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"eligibleSwapPathsBySymbol\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_erc20Address\",\"type\":\"address\"}],\"name\":\"isERC20AddressEligible\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_path\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"isPoolAddressEligible\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_isEligible\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"paths\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"poolAddresses\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_tokenSymbol\",\"type\":\"string\"}],\"name\":\"removePath\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"removePoolToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"swapExactInETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fromAmount\",\"type\":\"uint256\"}],\"name\":\"swapExactInToken\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAmount\",\"type\":\"uint256\"}],\"name\":\"swapExactOutETH\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAmount\",\"type\":\"uint256\"}],\"name\":\"swapExactOutToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"tokenSymbolsForPaths\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_erc20Addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"events\":{\"Redeemed(address,address,address[],uint256[])\":{\"params\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"poolToken\":\"The address of the Toucan pool token used in the redemption, e.g., NCT\",\"sender\":\"The sender of the transaction\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}}},\"kind\":\"dev\",\"methods\":{\"addPath(string,address[])\":{\"params\":{\"_path\":\"The path of the path to add\",\"_tokenSymbol\":\"The symbol of the token to add\"}},\"addPoolToken(address)\":{\"params\":{\"_poolToken\":\"The address of the pool token to add\"}},\"autoOffsetExactInETH(address)\":{\"details\":\"This function is only available on Polygon, not on Celo.\",\"params\":{\"_poolToken\":\"The address of the pool token to offset, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoOffsetExactInToken(address,address,uint256)\":{\"details\":\"When automatically redeeming pool tokens for the lowest quality TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool token.\",\"params\":{\"_amountToSwap\":\"The amount of ERC20 token to swap into Toucan pool token. Full amount will be used for offsetting.\",\"_fromToken\":\"The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\",\"_poolToken\":\"The address of the pool token to offset, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoOffsetExactOutETH(address,uint256)\":{\"details\":\"If the user sends too much native tokens , the leftover amount will be sent back to the user. This function is only available on Polygon, not on Celo.\",\"params\":{\"_amountToOffset\":\"The amount of TCO2 to offset.\",\"_poolToken\":\"The address of the pool token to offset, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoOffsetExactOutToken(address,address,uint256)\":{\"details\":\"When automatically redeeming pool tokens for the lowest quality TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool token.\",\"params\":{\"_amountToOffset\":\"The amount of TCO2 to offset\",\"_fromToken\":\"The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\",\"_poolToken\":\"The address of the Toucan pool token that the user wants to offset, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoOffsetPoolToken(address,uint256)\":{\"params\":{\"_amountToOffset\":\"The amount of TCO2 to offset.\",\"_poolToken\":\"The address of the pool token to offset, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoRedeem(address,uint256)\":{\"details\":\"Needs to be approved on the client side\",\"params\":{\"_amount\":\"Amount to redeem\",\"_fromToken\":\"Could be the address of NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoRetire(address[],uint256[])\":{\"params\":{\"_amounts\":\"The amounts to retire from each of the corresponding TCO2 addresses\",\"_tco2s\":\"The addresses of the TCO2s to retire\"}},\"calculateExpectedPoolTokenForETH(address,uint256)\":{\"params\":{\"_fromTokenAmount\":\"The amount of native tokens to swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amountOut\":\"The expected amount of Pool token that can be acquired\"}},\"calculateExpectedPoolTokenForToken(address,address,uint256)\":{\"params\":{\"_fromAmount\":\"The amount of ERC20 token to swap\",\"_fromToken\":\"The address of the ERC20 token used for the swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amountOut\":\"The expected amount of Pool token that can be acquired\"}},\"calculateNeededETHAmount(address,uint256)\":{\"params\":{\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\",\"_toAmount\":\"The desired amount of pool token to receive\"},\"returns\":{\"amountIn\":\"The amount of native tokens required in order to swap for the specified amount of the pool token\"}},\"calculateNeededTokenAmount(address,address,uint256)\":{\"params\":{\"_fromToken\":\"The address of the ERC20 token used for the swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\",\"_toAmount\":\"The desired amount of pool token to receive\"},\"returns\":{\"amountIn\":\"The amount of the ERC20 token required in order to swap for the specified amount of the pool token\"}},\"constructor\":{\"details\":\"See `isEligible()` for a list of tokens that can be used in the contract. These can be modified after deployment by the contract owner using `setEligibleTokenAddress()` and `deleteEligibleTokenAddress()`.\",\"params\":{\"_paths\":\"An array of arrays of addresses to describe the path needed to swap form the baseToken to the pool Token to the provided token symbols.\",\"_poolAddresses\":\"A list of pool token addresses.\",\"_tokenSymbolsForPaths\":\"An array of symbols of the token the user want to retire carbon credits for\"}},\"deposit(address,uint256)\":{\"details\":\"Needs to be approved\"},\"isERC20AddressEligible(address)\":{\"params\":{\"_erc20Address\":\"The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\"},\"returns\":{\"_path\":\"Returns the path of the token to be exchanged\"}},\"isPoolAddressEligible(address)\":{\"params\":{\"_poolToken\":\"The address of the pool token to offset, e.g., NCT\"},\"returns\":{\"_isEligible\":\"Returns a bool if the Pool token is eligible for offsetting\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"removePath(string)\":{\"params\":{\"_tokenSymbol\":\"The symbol of the path to remove\"}},\"removePoolToken(address)\":{\"params\":{\"_poolToken\":\"The address of the pool token to remove\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"swapExactInETH(address)\":{\"params\":{\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amountOut\":\"Resulting amount of Toucan pool token that got acquired for the swapped native tokens .\"}},\"swapExactInToken(address,address,uint256)\":{\"details\":\"Needs to be approved on the client side.\",\"params\":{\"_fromAmount\":\"The amount of ERC20 token to swap\",\"_fromToken\":\"The address of the ERC20 token used for the swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amountOut\":\"Resulting amount of Toucan pool token that got acquired for the swapped ERC20 tokens.\"}},\"swapExactOutETH(address,uint256)\":{\"params\":{\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\",\"_toAmount\":\"The required amount of the Toucan pool token (NCT/BCT)\"}},\"swapExactOutToken(address,address,uint256)\":{\"details\":\"Needs to be approved on the client side\",\"params\":{\"_fromToken\":\"The address of the ERC20 token used for the swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\",\"_toAmount\":\"The required amount of the Toucan pool token (NCT/BCT)\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"title\":\"Toucan Protocol Offset Helpers\",\"version\":1},\"userdoc\":{\"events\":{\"Redeemed(address,address,address[],uint256[])\":{\"notice\":\"Emitted upon successful redemption of TCO2 tokens from a Toucan pool token e.g., NCT.\"}},\"kind\":\"user\",\"methods\":{\"addPath(string,address[])\":{\"notice\":\"Change or add eligible paths and their addresses.\"},\"addPoolToken(address)\":{\"notice\":\"Change or add pool token addresses.\"},\"autoOffsetExactInETH(address)\":{\"notice\":\"Retire carbon credits using the lowest quality (oldest) TCO2 tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC. All provided native tokens is consumed for offsetting. The `view` helper function `calculateExpectedPoolTokenForETH()` can be used to calculate the expected amount of TCO2s that will be offset using `autoOffsetExactInETH()`. This function: 1. Swaps the native token e.g. MATIC sent to the contract for the specified pool token. 2. Redeems the pool token for the poorest quality TCO2 tokens available. 3. Retires the TCO2 tokens.\"},\"autoOffsetExactInToken(address,address,uint256)\":{\"notice\":\"Retire carbon credits using the lowest quality (oldest) TCO2 tokens available from the specified Toucan token pool by sending ERC20 tokens (cUSD, USDC, WETH, WMATIC). All provided token is consumed for offsetting. The `view` helper function `calculateExpectedPoolTokenForToken()` can be used to calculate the expected amount of TCO2s that will be offset using `autoOffsetExactInToken()`. This function: 1. Swaps the ERC20 token sent to the contract for the specified pool token. 2. Redeems the pool token for the poorest quality TCO2 tokens available. 3. Retires the TCO2 tokens. Note: The client must approve the ERC20 token that is sent to the contract.\"},\"autoOffsetExactOutETH(address,uint256)\":{\"notice\":\"Retire carbon credits using the lowest quality (oldest) TCO2 tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC. The `view` helper function `calculateNeededETHAmount()` should be called before using `autoOffsetExactOutETH()`, to determine how much native tokens e.g., MATIC must be sent to the `OffsetHelper` contract in order to retire the specified amount of carbon. This function: 1. Swaps the native token e.g. MATIC sent to the contract for the specified pool token. 2. Redeems the pool token for the poorest quality TCO2 tokens available. 3. Retires the TCO2 tokens.\"},\"autoOffsetExactOutToken(address,address,uint256)\":{\"notice\":\"Retire carbon credits using the lowest quality (oldest) TCO2 tokens available from the specified Toucan token pool by sending ERC20 tokens (cUSD, USDC, WETH, WMATIC). The `view` helper function `calculateNeededTokenAmount()` should be called before using `autoOffsetExactOutToken()`, to determine how much native tokens e.g., MATIC must be sent to the `OffsetHelper` contract in order to retire the specified amount of carbon. This function: 1. Swaps the ERC20 token sent to the contract for the specified pool token. 2. Redeems the pool token for the poorest quality TCO2 tokens available. 3. Retires the TCO2 tokens. Note: The client must approve the ERC20 token that is sent to the contract.\"},\"autoOffsetPoolToken(address,uint256)\":{\"notice\":\"Retire carbon credits using the lowest quality (oldest) TCO2 tokens available by sending Toucan pool tokens, e.g., NCT. This function: 1. Redeems the pool token for the poorest quality TCO2 tokens available. 2. Retires the TCO2 tokens. Note: The client must approve the pool token that is sent.\"},\"autoRedeem(address,uint256)\":{\"notice\":\"Redeems the specified amount of NCT / BCT for TCO2.\"},\"autoRetire(address[],uint256[])\":{\"notice\":\"Retire the specified TCO2 tokens.\"},\"calculateExpectedPoolTokenForETH(address,uint256)\":{\"notice\":\"Calculates the expected amount of Toucan Pool token that can be acquired by swapping the provided amount of native tokens e.g., MATIC.\"},\"calculateExpectedPoolTokenForToken(address,address,uint256)\":{\"notice\":\"Calculates the expected amount of Toucan Pool token that can be acquired by swapping the provided amount of ERC20 token.\"},\"calculateNeededETHAmount(address,uint256)\":{\"notice\":\"Return how much native tokens e.g, MATIC is required in order to swap for the desired amount of a Toucan pool token, e.g., NCT.\"},\"calculateNeededTokenAmount(address,address,uint256)\":{\"notice\":\"Return how much of the specified ERC20 token is required in order to swap for the desired amount of a Toucan pool token, for example, e.g., NCT.\"},\"constructor\":{\"notice\":\"Contract constructor. Should specify arrays of ERC20 symbols and addresses that can used by the contract.\"},\"deposit(address,uint256)\":{\"notice\":\"Allow users to deposit BCT / NCT.\"},\"isERC20AddressEligible(address)\":{\"notice\":\"Checks if ERC20 Token is eligible for swapping.\"},\"isPoolAddressEligible(address)\":{\"notice\":\"Checks if Pool Address is eligible for offsetting.\"},\"removePath(string)\":{\"notice\":\"Delete eligible tokens stored in the contract.\"},\"removePoolToken(address)\":{\"notice\":\"Delete eligible pool token addresses stored in the contract.\"},\"swapExactInETH(address)\":{\"notice\":\"Swap native tokens e.g., MATIC for Toucan pool tokens (BCT/NCT) on SushiSwap. All provided native tokens will be swapped.\"},\"swapExactInToken(address,address,uint256)\":{\"notice\":\"Swap eligible ERC20 tokens for Toucan pool tokens (BCT/NCT) on SushiSwap. All provided ERC20 tokens will be swapped.\"},\"swapExactOutETH(address,uint256)\":{\"notice\":\"Swap native tokens e.g., MATIC for Toucan pool tokens (BCT/NCT) on SushiSwap. Remaining native tokens that was not consumed by the swap is returned.\"},\"swapExactOutToken(address,address,uint256)\":{\"notice\":\"Swap eligible ERC20 tokens for Toucan pool tokens (BCT/NCT) on SushiSwap\"},\"withdraw(address,uint256)\":{\"notice\":\"Allow users to withdraw tokens they have deposited.\"}},\"notice\":\"Helper functions that simplify the carbon offsetting (retirement) process. Retiring carbon tokens requires multiple steps and interactions with Toucan Protocol's main contracts: 1. Obtain a Toucan pool token e.g., NCT (by performing a token swap on a DEX). 2. Redeem the pool token for a TCO2 token. 3. Retire the TCO2 token. These steps are combined in each of the following \\\"auto offset\\\" methods implemented in `OffsetHelper` to allow a retirement within one transaction: - `autoOffsetPoolToken()` if the user already owns a Toucan pool token e.g., NCT, - `autoOffsetExactOutETH()` if the user would like to perform a retirement using native tokens e.g., MATIC, specifying the exact amount of TCO2s to retire (only on Polygon, not on Celo), - `autoOffsetExactInETH()` if the user would like to perform a retirement using native tokens, swapping all sent native tokens into TCO2s (only on Polygon, not on Celo), - `autoOffsetExactOutToken()` if the user would like to perform a retirement using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount of TCO2s to retire, - `autoOffsetExactInToken()` if the user would like to perform a retirement using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount of token to swap into TCO2s. In these methods, \\\"auto\\\" refers to the fact that these methods use `autoRedeem()` in order to automatically choose a TCO2 token corresponding to the oldest tokenized carbon project in the specfified token pool. There are no fees incurred by the user when using `autoRedeem()`, i.e., the user receives 1 TCO2 token for each pool token (BCT/NCT) redeemed. There are two `view` helper functions `calculateNeededETHAmount()` and `calculateNeededTokenAmount()` that should be called before using `autoOffsetExactOutETH()` and `autoOffsetExactOutToken()`, to determine how much native tokens e.g., MATIC, respectively how much of the ERC20 token must be sent to the `OffsetHelper` contract in order to retire the specified amount of carbon. The two `view` helper functions `calculateExpectedPoolTokenForETH()` and `calculateExpectedPoolTokenForToken()` can be used to calculate the expected amount of TCO2s that will be offset using functions `autoOffsetExactInETH()` and `autoOffsetExactInToken()`.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/OffsetHelper.sol\":\"OffsetHelper\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x247c62047745915c0af6b955470a72d1696ebad4352d7d3011aef1a2463cd888\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0xe798cadb41e2da274913e4b3183a80f50fb057a42238fe8467e077268100ec27\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20Upgradeable {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x4e733d3164f73f461eaf9d8087a7ad1ea180bdc8ba0d3d61b0e1ae16d8e63dff\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2edcb41c121abc510932e8d83ff8b82cf9cdde35e7c297622f5c29ef0af25183\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n function safePermit(\\n IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9b72f93be69ca894d8492c244259615c4a742afc8d63720dbc8bb81087d9b238\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721Receiver {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol\":{\"content\":\"pragma solidity >=0.6.2;\\n\\ninterface IUniswapV2Router01 {\\n function factory() external pure returns (address);\\n function WETH() external pure returns (address);\\n\\n function addLiquidity(\\n address tokenA,\\n address tokenB,\\n uint amountADesired,\\n uint amountBDesired,\\n uint amountAMin,\\n uint amountBMin,\\n address to,\\n uint deadline\\n ) external returns (uint amountA, uint amountB, uint liquidity);\\n function addLiquidityETH(\\n address token,\\n uint amountTokenDesired,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline\\n ) external payable returns (uint amountToken, uint amountETH, uint liquidity);\\n function removeLiquidity(\\n address tokenA,\\n address tokenB,\\n uint liquidity,\\n uint amountAMin,\\n uint amountBMin,\\n address to,\\n uint deadline\\n ) external returns (uint amountA, uint amountB);\\n function removeLiquidityETH(\\n address token,\\n uint liquidity,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline\\n ) external returns (uint amountToken, uint amountETH);\\n function removeLiquidityWithPermit(\\n address tokenA,\\n address tokenB,\\n uint liquidity,\\n uint amountAMin,\\n uint amountBMin,\\n address to,\\n uint deadline,\\n bool approveMax, uint8 v, bytes32 r, bytes32 s\\n ) external returns (uint amountA, uint amountB);\\n function removeLiquidityETHWithPermit(\\n address token,\\n uint liquidity,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline,\\n bool approveMax, uint8 v, bytes32 r, bytes32 s\\n ) external returns (uint amountToken, uint amountETH);\\n function swapExactTokensForTokens(\\n uint amountIn,\\n uint amountOutMin,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external returns (uint[] memory amounts);\\n function swapTokensForExactTokens(\\n uint amountOut,\\n uint amountInMax,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external returns (uint[] memory amounts);\\n function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)\\n external\\n payable\\n returns (uint[] memory amounts);\\n function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)\\n external\\n returns (uint[] memory amounts);\\n function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)\\n external\\n returns (uint[] memory amounts);\\n function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)\\n external\\n payable\\n returns (uint[] memory amounts);\\n\\n function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);\\n function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);\\n function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);\\n function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);\\n function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);\\n}\\n\",\"keccak256\":\"0x8a3c5c449d4b7cd76513ed6995f4b86e4a86f222c770f8442f5fc128ce29b4d2\"},\"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\":{\"content\":\"pragma solidity >=0.6.2;\\n\\nimport './IUniswapV2Router01.sol';\\n\\ninterface IUniswapV2Router02 is IUniswapV2Router01 {\\n function removeLiquidityETHSupportingFeeOnTransferTokens(\\n address token,\\n uint liquidity,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline\\n ) external returns (uint amountETH);\\n function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(\\n address token,\\n uint liquidity,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline,\\n bool approveMax, uint8 v, bytes32 r, bytes32 s\\n ) external returns (uint amountETH);\\n\\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\\n uint amountIn,\\n uint amountOutMin,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external;\\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\\n uint amountOutMin,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external payable;\\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\\n uint amountIn,\\n uint amountOutMin,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external;\\n}\\n\",\"keccak256\":\"0x744e30c133bd0f7ca9e7163433cf6d72f45c6bb1508c2c9c02f1a6db796ae59d\"},\"contracts/OffsetHelper.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2022 Toucan Labs\\n// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\\\";\\nimport \\\"./OffsetHelperStorage.sol\\\";\\nimport \\\"./interfaces/IToucanPoolToken.sol\\\";\\nimport \\\"./interfaces/IToucanCarbonOffsets.sol\\\";\\nimport \\\"./interfaces/IToucanContractRegistry.sol\\\";\\n\\n/**\\n * @title Toucan Protocol Offset Helpers\\n * @notice Helper functions that simplify the carbon offsetting (retirement)\\n * process.\\n *\\n * Retiring carbon tokens requires multiple steps and interactions with\\n * Toucan Protocol's main contracts:\\n * 1. Obtain a Toucan pool token e.g., NCT (by performing a token\\n * swap on a DEX).\\n * 2. Redeem the pool token for a TCO2 token.\\n * 3. Retire the TCO2 token.\\n *\\n * These steps are combined in each of the following \\\"auto offset\\\" methods\\n * implemented in `OffsetHelper` to allow a retirement within one transaction:\\n * - `autoOffsetPoolToken()` if the user already owns a Toucan pool\\n * token e.g., NCT,\\n * - `autoOffsetExactOutETH()` if the user would like to perform a retirement\\n * using native tokens e.g., MATIC, specifying the exact amount of TCO2s to retire (only on Polygon, not on Celo),\\n * - `autoOffsetExactInETH()` if the user would like to perform a retirement\\n * using native tokens, swapping all sent native tokens into TCO2s (only on Polygon, not on Celo),\\n * - `autoOffsetExactOutToken()` if the user would like to perform a retirement\\n * using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount\\n * of TCO2s to retire,\\n * - `autoOffsetExactInToken()` if the user would like to perform a retirement\\n * using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount\\n * of token to swap into TCO2s.\\n *\\n * In these methods, \\\"auto\\\" refers to the fact that these methods use\\n * `autoRedeem()` in order to automatically choose a TCO2 token corresponding\\n * to the oldest tokenized carbon project in the specfified token pool.\\n * There are no fees incurred by the user when using `autoRedeem()`, i.e., the\\n * user receives 1 TCO2 token for each pool token (BCT/NCT) redeemed.\\n *\\n * There are two `view` helper functions `calculateNeededETHAmount()` and\\n * `calculateNeededTokenAmount()` that should be called before using\\n * `autoOffsetExactOutETH()` and `autoOffsetExactOutToken()`, to determine how\\n * much native tokens e.g., MATIC, respectively how much of the ERC20 token must be sent to the\\n * `OffsetHelper` contract in order to retire the specified amount of carbon.\\n *\\n * The two `view` helper functions `calculateExpectedPoolTokenForETH()` and\\n * `calculateExpectedPoolTokenForToken()` can be used to calculate the\\n * expected amount of TCO2s that will be offset using functions\\n * `autoOffsetExactInETH()` and `autoOffsetExactInToken()`.\\n */\\ncontract OffsetHelper is OffsetHelperStorage {\\n using SafeERC20 for IERC20;\\n // Chain ID of Celo mainnet\\n uint256 private constant CELO_MAINNET_CHAINID = 42220;\\n\\n /**\\n * @notice Emitted upon successful redemption of TCO2 tokens from a Toucan\\n * pool token e.g., NCT.\\n *\\n * @param sender The sender of the transaction\\n * @param poolToken The address of the Toucan pool token used in the\\n * redemption, e.g., NCT\\n * @param tco2s An array of the TCO2 addresses that were redeemed\\n * @param amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n event Redeemed(\\n address sender,\\n address poolToken,\\n address[] tco2s,\\n uint256[] amounts\\n );\\n\\n modifier onlyRedeemable(address _token) {\\n require(isRedeemable(_token), \\\"Token not redeemable\\\");\\n\\n _;\\n }\\n\\n modifier onlySwappable(address _token) {\\n require(isSwappable(_token), \\\"Path doesn't yet exists.\\\");\\n\\n _;\\n }\\n\\n modifier nativeTokenChain() {\\n require(\\n block.chainid != CELO_MAINNET_CHAINID,\\n \\\"The function is not available on this network.\\\"\\n );\\n\\n _;\\n }\\n\\n /**\\n * @notice Contract constructor. Should specify arrays of ERC20 symbols and\\n * addresses that can used by the contract.\\n *\\n * @dev See `isEligible()` for a list of tokens that can be used in the\\n * contract. These can be modified after deployment by the contract owner\\n * using `setEligibleTokenAddress()` and `deleteEligibleTokenAddress()`.\\n *\\n * @param _poolAddresses A list of pool token addresses.\\n * @param _tokenSymbolsForPaths An array of symbols of the token the user want to retire carbon credits for\\n * @param _paths An array of arrays of addresses to describe the path needed to swap form the baseToken to the pool Token\\n * to the provided token symbols.\\n */\\n constructor(\\n address[] memory _poolAddresses,\\n string[] memory _tokenSymbolsForPaths,\\n address[][] memory _paths,\\n address _dexRouterAddress\\n ) {\\n dexRouterAddress = _dexRouterAddress;\\n poolAddresses = _poolAddresses;\\n tokenSymbolsForPaths = _tokenSymbolsForPaths;\\n paths = _paths;\\n\\n uint256 i = 0;\\n uint256 eligibleSwapPathsBySymbolLen = _tokenSymbolsForPaths.length;\\n while (i < eligibleSwapPathsBySymbolLen) {\\n eligibleSwapPaths[_paths[i][0]] = _paths[i];\\n eligibleSwapPathsBySymbol[_tokenSymbolsForPaths[i]] = _paths[i];\\n i += 1;\\n }\\n }\\n\\n // fallback payable and receive method to fix the situation where transfering dust native tokens\\n // in the native tokens to token swap fails\\n\\n receive() external payable {}\\n\\n fallback() external payable {}\\n\\n // ----------------------------------------\\n // Upgradable related functions\\n // ----------------------------------------\\n\\n function initialize() external virtual initializer {\\n __Ownable_init_unchained();\\n }\\n\\n // ----------------------------------------\\n // Public functions\\n // ----------------------------------------\\n\\n /**\\n * @notice Retire carbon credits using the lowest quality (oldest) TCO2\\n * tokens available from the specified Toucan token pool by sending ERC20\\n * tokens (cUSD, USDC, WETH, WMATIC). The `view` helper function\\n * `calculateNeededTokenAmount()` should be called before using `autoOffsetExactOutToken()`,\\n * to determine how much native tokens e.g., MATIC must be sent to the\\n * `OffsetHelper` contract in order to retire the specified amount of carbon.\\n *\\n * This function:\\n * 1. Swaps the ERC20 token sent to the contract for the specified pool token.\\n * 2. Redeems the pool token for the poorest quality TCO2 tokens available.\\n * 3. Retires the TCO2 tokens.\\n *\\n * Note: The client must approve the ERC20 token that is sent to the contract.\\n *\\n * @dev When automatically redeeming pool tokens for the lowest quality\\n * TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool\\n * token.\\n *\\n * @param _fromToken The address of the ERC20 token that the user sends\\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\\n * @param _poolToken The address of the Toucan pool token that the\\n * user wants to offset, e.g., NCT\\n * @param _amountToOffset The amount of TCO2 to offset\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetExactOutToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _amountToOffset\\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\\n // swap input token for BCT / NCT\\n swapExactOutToken(_fromToken, _poolToken, _amountToOffset);\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire carbon credits using the lowest quality (oldest) TCO2\\n * tokens available from the specified Toucan token pool by sending ERC20\\n * tokens (cUSD, USDC, WETH, WMATIC). All provided token is consumed for\\n * offsetting.\\n *\\n * The `view` helper function `calculateExpectedPoolTokenForToken()`\\n * can be used to calculate the expected amount of TCO2s that will be\\n * offset using `autoOffsetExactInToken()`.\\n *\\n * This function:\\n * 1. Swaps the ERC20 token sent to the contract for the specified pool token.\\n * 2. Redeems the pool token for the poorest quality TCO2 tokens available.\\n * 3. Retires the TCO2 tokens.\\n *\\n * Note: The client must approve the ERC20 token that is sent to the contract.\\n *\\n * @dev When automatically redeeming pool tokens for the lowest quality\\n * TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool\\n * token.\\n *\\n * @param _fromToken The address of the ERC20 token that the user sends\\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\\n * @param _poolToken The address of the pool token to offset,\\n * e.g., NCT\\n * @param _amountToSwap The amount of ERC20 token to swap into Toucan pool\\n * token. Full amount will be used for offsetting.\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetExactInToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _amountToSwap\\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\\n // swap input token for BCT / NCT\\n uint256 amountToOffset = swapExactInToken(\\n _fromToken,\\n _poolToken,\\n _amountToSwap\\n );\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire carbon credits using the lowest quality (oldest) TCO2\\n * tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC.\\n *\\n * The `view` helper function `calculateNeededETHAmount()` should be called before using\\n * `autoOffsetExactOutETH()`, to determine how much native tokens e.g.,\\n * MATIC must be sent to the `OffsetHelper` contract in order to retire\\n * the specified amount of carbon.\\n *\\n * This function:\\n * 1. Swaps the native token e.g. MATIC sent to the contract for the specified pool token.\\n * 2. Redeems the pool token for the poorest quality TCO2 tokens available.\\n * 3. Retires the TCO2 tokens.\\n *\\n * @dev If the user sends too much native tokens , the leftover amount will be sent back\\n * to the user. This function is only available on Polygon, not on Celo.\\n *\\n * @param _poolToken The address of the pool token to offset,\\n * e.g., NCT\\n * @param _amountToOffset The amount of TCO2 to offset.\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetExactOutETH(\\n address _poolToken,\\n uint256 _amountToOffset\\n )\\n public\\n payable\\n nativeTokenChain\\n returns (address[] memory tco2s, uint256[] memory amounts)\\n {\\n // swap native tokens for BCT / NCT\\n swapExactOutETH(_poolToken, _amountToOffset);\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire carbon credits using the lowest quality (oldest) TCO2\\n * tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC.\\n * All provided native tokens is consumed for offsetting.\\n *\\n * The `view` helper function `calculateExpectedPoolTokenForETH()` can be\\n * used to calculate the expected amount of TCO2s that will be offset\\n * using `autoOffsetExactInETH()`.\\n *\\n * This function:\\n * 1. Swaps the native token e.g. MATIC sent to the contract for the specified pool token.\\n * 2. Redeems the pool token for the poorest quality TCO2 tokens available.\\n * 3. Retires the TCO2 tokens.\\n *\\n * @dev This function is only available on Polygon, not on Celo.\\n *\\n * @param _poolToken The address of the pool token to offset,\\n * e.g., NCT\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetExactInETH(\\n address _poolToken\\n )\\n public\\n payable\\n nativeTokenChain\\n returns (address[] memory tco2s, uint256[] memory amounts)\\n {\\n // swap native tokens for BCT / NCT\\n uint256 amountToOffset = swapExactInETH(_poolToken);\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire carbon credits using the lowest quality (oldest) TCO2\\n * tokens available by sending Toucan pool tokens, e.g., NCT.\\n *\\n * This function:\\n * 1. Redeems the pool token for the poorest quality TCO2 tokens available.\\n * 2. Retires the TCO2 tokens.\\n *\\n * Note: The client must approve the pool token that is sent.\\n *\\n * @param _poolToken The address of the pool token to offset,\\n * e.g., NCT\\n * @param _amountToOffset The amount of TCO2 to offset.\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetPoolToken(\\n address _poolToken,\\n uint256 _amountToOffset\\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\\n // deposit pool token from user to this contract\\n deposit(_poolToken, _amountToOffset);\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Swap eligible ERC20 tokens for Toucan pool tokens (BCT/NCT) on SushiSwap\\n * @dev Needs to be approved on the client side\\n * @param _fromToken The address of the ERC20 token used for the swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _toAmount The required amount of the Toucan pool token (NCT/BCT)\\n */\\n function swapExactOutToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _toAmount\\n ) public onlySwappable(_fromToken) onlyRedeemable(_poolToken) {\\n // calculate path & amounts\\n (\\n address[] memory path,\\n uint256[] memory expAmounts\\n ) = calculateExactOutSwap(_fromToken, _poolToken, _toAmount);\\n uint256 amountIn = expAmounts[0];\\n\\n // transfer tokens\\n IERC20(_fromToken).safeTransferFrom(\\n msg.sender,\\n address(this),\\n amountIn\\n );\\n\\n // approve router\\n IERC20(_fromToken).approve(dexRouterAddress, amountIn);\\n\\n // swap\\n uint256[] memory amounts = dexRouter().swapTokensForExactTokens(\\n _toAmount,\\n amountIn, // max. input amount\\n path,\\n address(this),\\n block.timestamp\\n );\\n\\n // remove remaining approval if less input token was consumed\\n if (amounts[0] < amountIn) {\\n IERC20(_fromToken).approve(dexRouterAddress, 0);\\n }\\n\\n // update balances\\n balances[msg.sender][_poolToken] += _toAmount;\\n }\\n\\n /**\\n * @notice Swap eligible ERC20 tokens for Toucan pool tokens (BCT/NCT) on\\n * SushiSwap. All provided ERC20 tokens will be swapped.\\n * @dev Needs to be approved on the client side.\\n * @param _fromToken The address of the ERC20 token used for the swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _fromAmount The amount of ERC20 token to swap\\n * @return amountOut Resulting amount of Toucan pool token that got acquired for the\\n * swapped ERC20 tokens.\\n */\\n function swapExactInToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _fromAmount\\n )\\n public\\n onlySwappable(_fromToken)\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountOut)\\n {\\n // calculate path & amounts\\n\\n address[] memory path = generatePath(_fromToken, _poolToken);\\n\\n uint256 len = path.length;\\n\\n // transfer tokens\\n IERC20(_fromToken).safeTransferFrom(\\n msg.sender,\\n address(this),\\n _fromAmount\\n );\\n\\n // approve router\\n IERC20(_fromToken).safeApprove(dexRouterAddress, _fromAmount);\\n\\n // swap\\n uint256[] memory amounts = dexRouter().swapExactTokensForTokens(\\n _fromAmount,\\n 0, // min. output amount\\n path,\\n address(this),\\n block.timestamp\\n );\\n amountOut = amounts[len - 1];\\n\\n // update balances\\n balances[msg.sender][_poolToken] += amountOut;\\n }\\n\\n /**\\n * @notice Swap native tokens e.g., MATIC for Toucan pool tokens (BCT/NCT) on SushiSwap.\\n * Remaining native tokens that was not consumed by the swap is returned.\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _toAmount The required amount of the Toucan pool token (NCT/BCT)\\n */\\n function swapExactOutETH(\\n address _poolToken,\\n uint256 _toAmount\\n ) public payable nativeTokenChain onlyRedeemable(_poolToken) {\\n // create path & amounts\\n // wrap the native token\\n address fromToken = eligibleSwapPathsBySymbol[\\\"WMATIC\\\"][0];\\n address[] memory path = generatePath(fromToken, _poolToken);\\n\\n // swap\\n uint256[] memory amounts = dexRouter().swapETHForExactTokens{\\n value: msg.value\\n }(_toAmount, path, address(this), block.timestamp);\\n\\n // send surplus back\\n if (msg.value > amounts[0]) {\\n uint256 leftoverETH = msg.value - amounts[0];\\n (bool success, ) = msg.sender.call{value: leftoverETH}(\\n new bytes(0)\\n );\\n\\n require(success, \\\"Failed to send surplus back\\\");\\n }\\n\\n // update balances\\n balances[msg.sender][_poolToken] += _toAmount;\\n }\\n\\n /**\\n * @notice Swap native tokens e.g., MATIC for Toucan pool tokens (BCT/NCT) on SushiSwap. All\\n * provided native tokens will be swapped.\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @return amountOut Resulting amount of Toucan pool token that got acquired for the\\n * swapped native tokens .\\n */\\n function swapExactInETH(\\n address _poolToken\\n )\\n public\\n payable\\n nativeTokenChain\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountOut)\\n {\\n // create path & amounts\\n uint256 fromAmount = msg.value;\\n // wrap the native token\\n address fromToken = eligibleSwapPathsBySymbol[\\\"WMATIC\\\"][0];\\n address[] memory path = generatePath(fromToken, _poolToken);\\n\\n uint256 len = path.length;\\n\\n // swap\\n uint256[] memory amounts = dexRouter().swapExactETHForTokens{\\n value: fromAmount\\n }(0, path, address(this), block.timestamp);\\n amountOut = amounts[len - 1];\\n\\n // update balances\\n balances[msg.sender][_poolToken] += amountOut;\\n }\\n\\n /**\\n * @notice Allow users to withdraw tokens they have deposited.\\n */\\n function withdraw(address _erc20Addr, uint256 _amount) public {\\n require(\\n balances[msg.sender][_erc20Addr] >= _amount,\\n \\\"Insufficient balance\\\"\\n );\\n\\n IERC20(_erc20Addr).safeTransfer(msg.sender, _amount);\\n balances[msg.sender][_erc20Addr] -= _amount;\\n }\\n\\n /**\\n * @notice Allow users to deposit BCT / NCT.\\n * @dev Needs to be approved\\n */\\n function deposit(\\n address _erc20Addr,\\n uint256 _amount\\n ) public onlyRedeemable(_erc20Addr) {\\n IERC20(_erc20Addr).safeTransferFrom(msg.sender, address(this), _amount);\\n balances[msg.sender][_erc20Addr] += _amount;\\n }\\n\\n /**\\n * @notice Redeems the specified amount of NCT / BCT for TCO2.\\n * @dev Needs to be approved on the client side\\n * @param _fromToken Could be the address of NCT\\n * @param _amount Amount to redeem\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoRedeem(\\n address _fromToken,\\n uint256 _amount\\n )\\n public\\n onlyRedeemable(_fromToken)\\n returns (address[] memory tco2s, uint256[] memory amounts)\\n {\\n require(\\n balances[msg.sender][_fromToken] >= _amount,\\n \\\"Insufficient NCT/BCT balance\\\"\\n );\\n\\n // instantiate pool token (NCT)\\n IToucanPoolToken PoolTokenImplementation = IToucanPoolToken(_fromToken);\\n\\n // auto redeem pool token for TCO2; will transfer automatically picked TCO2 to this contract\\n (tco2s, amounts) = PoolTokenImplementation.redeemAuto2(_amount);\\n\\n // update balances\\n balances[msg.sender][_fromToken] -= _amount;\\n uint256 tco2sLen = tco2s.length;\\n for (uint256 index = 0; index < tco2sLen; index++) {\\n balances[msg.sender][tco2s[index]] += amounts[index];\\n }\\n\\n emit Redeemed(msg.sender, _fromToken, tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire the specified TCO2 tokens.\\n * @param _tco2s The addresses of the TCO2s to retire\\n * @param _amounts The amounts to retire from each of the corresponding\\n * TCO2 addresses\\n */\\n function autoRetire(\\n address[] memory _tco2s,\\n uint256[] memory _amounts\\n ) public {\\n uint256 tco2sLen = _tco2s.length;\\n require(tco2sLen != 0, \\\"Array empty\\\");\\n\\n require(tco2sLen == _amounts.length, \\\"Arrays unequal\\\");\\n\\n uint256 i = 0;\\n while (i < tco2sLen) {\\n if (_amounts[i] == 0) {\\n unchecked {\\n i++;\\n }\\n continue;\\n }\\n require(\\n balances[msg.sender][_tco2s[i]] >= _amounts[i],\\n \\\"Insufficient TCO2 balance\\\"\\n );\\n\\n balances[msg.sender][_tco2s[i]] -= _amounts[i];\\n\\n IToucanCarbonOffsets(_tco2s[i]).retire(_amounts[i]);\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n // ----------------------------------------\\n // Public view functions\\n // ----------------------------------------\\n\\n /**\\n * @notice Return how much of the specified ERC20 token is required in\\n * order to swap for the desired amount of a Toucan pool token, for\\n * example, e.g., NCT.\\n *\\n * @param _fromToken The address of the ERC20 token used for the swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _toAmount The desired amount of pool token to receive\\n * @return amountIn The amount of the ERC20 token required in order to\\n * swap for the specified amount of the pool token\\n */\\n function calculateNeededTokenAmount(\\n address _fromToken,\\n address _poolToken,\\n uint256 _toAmount\\n )\\n public\\n view\\n onlySwappable(_fromToken)\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountIn)\\n {\\n (, uint256[] memory amounts) = calculateExactOutSwap(\\n _fromToken,\\n _poolToken,\\n _toAmount\\n );\\n amountIn = amounts[0];\\n }\\n\\n /**\\n * @notice Calculates the expected amount of Toucan Pool token that can be\\n * acquired by swapping the provided amount of ERC20 token.\\n *\\n * @param _fromToken The address of the ERC20 token used for the swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _fromAmount The amount of ERC20 token to swap\\n * @return amountOut The expected amount of Pool token that can be acquired\\n */\\n function calculateExpectedPoolTokenForToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _fromAmount\\n )\\n public\\n view\\n onlySwappable(_fromToken)\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountOut)\\n {\\n (, uint256[] memory amounts) = calculateExactInSwap(\\n _fromToken,\\n _poolToken,\\n _fromAmount\\n );\\n amountOut = amounts[amounts.length - 1];\\n }\\n\\n /**\\n * @notice Return how much native tokens e.g, MATIC is required in order to swap for the\\n * desired amount of a Toucan pool token, e.g., NCT.\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _toAmount The desired amount of pool token to receive\\n * @return amountIn The amount of native tokens required in order to swap for\\n * the specified amount of the pool token\\n */\\n function calculateNeededETHAmount(\\n address _poolToken,\\n uint256 _toAmount\\n )\\n public\\n view\\n nativeTokenChain\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountIn)\\n {\\n address fromToken = eligibleSwapPathsBySymbol[\\\"WMATIC\\\"][0];\\n (, uint256[] memory amounts) = calculateExactOutSwap(\\n fromToken,\\n _poolToken,\\n _toAmount\\n );\\n amountIn = amounts[0];\\n }\\n\\n /**\\n * @notice Calculates the expected amount of Toucan Pool token that can be\\n * acquired by swapping the provided amount of native tokens e.g., MATIC.\\n *\\n * @param _fromTokenAmount The amount of native tokens to swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @return amountOut The expected amount of Pool token that can be acquired\\n */\\n function calculateExpectedPoolTokenForETH(\\n address _poolToken,\\n uint256 _fromTokenAmount\\n )\\n public\\n view\\n nativeTokenChain\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountOut)\\n {\\n address fromToken = eligibleSwapPathsBySymbol[\\\"WMATIC\\\"][0];\\n (, uint256[] memory amounts) = calculateExactInSwap(\\n fromToken,\\n _poolToken,\\n _fromTokenAmount\\n );\\n amountOut = amounts[amounts.length - 1];\\n }\\n\\n /**\\n * @notice Checks if Pool Address is eligible for offsetting.\\n * @param _poolToken The address of the pool token to offset,\\n * e.g., NCT\\n * @return _isEligible Returns a bool if the Pool token is eligible for offsetting\\n */\\n function isPoolAddressEligible(\\n address _poolToken\\n ) public view returns (bool _isEligible) {\\n _isEligible = isRedeemable(_poolToken);\\n }\\n\\n /**\\n * @notice Checks if ERC20 Token is eligible for swapping.\\n * @param _erc20Address The address of the ERC20 token that the user sends\\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\\n * @return _path Returns the path of the token to be exchanged\\n */\\n function isERC20AddressEligible(\\n address _erc20Address\\n ) public view returns (address[] memory _path) {\\n _path = eligibleSwapPaths[_erc20Address];\\n }\\n\\n // ----------------------------------------\\n // Internal methods\\n // ----------------------------------------\\n\\n function calculateExactOutSwap(\\n address _fromToken,\\n address _poolToken,\\n uint256 _toAmount\\n ) internal view returns (address[] memory path, uint256[] memory amounts) {\\n // create path & calculate amounts\\n path = generatePath(_fromToken, _poolToken);\\n uint256 len = path.length;\\n\\n amounts = dexRouter().getAmountsIn(_toAmount, path);\\n\\n // sanity check arrays\\n require(len == amounts.length, \\\"Arrays unequal\\\");\\n require(_toAmount == amounts[len - 1], \\\"Output amount mismatch\\\");\\n }\\n\\n function calculateExactInSwap(\\n address _fromToken,\\n address _poolToken,\\n uint256 _fromAmount\\n ) internal view returns (address[] memory path, uint256[] memory amounts) {\\n // create path & calculate amounts\\n path = generatePath(_fromToken, _poolToken);\\n uint256 len = path.length;\\n\\n amounts = dexRouter().getAmountsOut(_fromAmount, path);\\n\\n // sanity check arrays\\n require(len == amounts.length, \\\"Arrays unequal\\\");\\n require(_fromAmount == amounts[0], \\\"Input amount mismatch\\\");\\n }\\n\\n /**\\n * @notice Show all pool token addresses that can be used to retired.\\n * @param _fromToken a list of token symbols that can be retired.\\n * @param _toToken a list of token symbols that can be retired.\\n */\\n function generatePath(\\n address _fromToken,\\n address _toToken\\n ) internal view returns (address[] memory path) {\\n uint256 len = eligibleSwapPaths[_fromToken].length;\\n if (len == 1) {\\n path = new address[](2);\\n path[0] = _fromToken;\\n path[1] = _toToken;\\n return path;\\n }\\n if (len == 2) {\\n path = new address[](3);\\n path[0] = _fromToken;\\n path[1] = eligibleSwapPaths[_fromToken][1];\\n path[2] = _toToken;\\n return path;\\n }\\n if (len == 3) {\\n path = new address[](3);\\n path[0] = _fromToken;\\n path[1] = eligibleSwapPaths[_fromToken][1];\\n path[2] = eligibleSwapPaths[_fromToken][2];\\n path[3] = _toToken;\\n return path;\\n } else {\\n path = new address[](4);\\n path[0] = _fromToken;\\n path[1] = eligibleSwapPaths[_fromToken][1];\\n path[2] = eligibleSwapPaths[_fromToken][2];\\n path[3] = eligibleSwapPaths[_fromToken][3];\\n path[4] = _toToken;\\n return path;\\n }\\n }\\n\\n function dexRouter() internal view returns (IUniswapV2Router02) {\\n return IUniswapV2Router02(dexRouterAddress);\\n }\\n\\n /**\\n * @notice Checks whether an address is a Toucan pool token address\\n * @param _erc20Address address of token to be checked\\n * @return True if the address is a Toucan pool token address\\n */\\n function isRedeemable(address _erc20Address) private view returns (bool) {\\n for (uint i = 0; i < poolAddresses.length; i++) {\\n if (poolAddresses[i] == _erc20Address) {\\n return true;\\n }\\n }\\n\\n return false;\\n }\\n\\n /**\\n * @notice Checks whether an address can be used in a token swap\\n * @param _erc20Address address of token to be checked\\n * @return True if the specified address can be used in a swap\\n */\\n function isSwappable(address _erc20Address) private view returns (bool) {\\n for (uint i = 0; i < paths.length; i++) {\\n if (paths[i][0] == _erc20Address) {\\n return true;\\n }\\n }\\n\\n return false;\\n }\\n\\n /**\\n * @notice Cheks if Pool Token is eligible for Offsetting.\\n * @param _poolToken The addresses of the pool token to redeem\\n * @return _isEligible Returns if token can be redeemed\\n */\\n\\n // ----------------------------------------\\n // Admin methods\\n // ----------------------------------------\\n\\n /**\\n * @notice Change or add eligible paths and their addresses.\\n * @param _tokenSymbol The symbol of the token to add\\n * @param _path The path of the path to add\\n */\\n function addPath(\\n string memory _tokenSymbol,\\n address[] memory _path\\n ) public virtual onlyOwner {\\n eligibleSwapPaths[_path[0]] = _path;\\n eligibleSwapPathsBySymbol[_tokenSymbol] = _path;\\n tokenSymbolsForPaths.push(_tokenSymbol);\\n }\\n\\n /**\\n * @notice Delete eligible tokens stored in the contract.\\n * @param _tokenSymbol The symbol of the path to remove\\n */\\n function removePath(string memory _tokenSymbol) public virtual onlyOwner {\\n delete eligibleSwapPaths[eligibleSwapPathsBySymbol[_tokenSymbol][0]];\\n delete eligibleSwapPathsBySymbol[_tokenSymbol];\\n }\\n\\n /**\\n * @notice Change or add pool token addresses.\\n * @param _poolToken The address of the pool token to add\\n */\\n function addPoolToken(address _poolToken) public virtual onlyOwner {\\n poolAddresses.push(_poolToken);\\n }\\n\\n /**\\n * @notice Delete eligible pool token addresses stored in the contract.\\n * @param _poolToken The address of the pool token to remove\\n */\\n function removePoolToken(address _poolToken) public virtual onlyOwner {\\n for (uint256 i; i < poolAddresses.length; i++) {\\n if (poolAddresses[i] == _poolToken) {\\n poolAddresses[i] = poolAddresses[poolAddresses.length - 1];\\n poolAddresses.pop();\\n break;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x00812c8474fe0303b130513d22e4a8cf4866cb16c3a5099203ef3fd769dc1f8a\",\"license\":\"GPL-3.0\"},\"contracts/OffsetHelperStorage.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2022 Toucan Labs\\n//\\n// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\n\\ncontract OffsetHelperStorage is OwnableUpgradeable {\\n // token symbol => token address\\n mapping(address => address[]) public eligibleSwapPaths;\\n mapping(string => address[]) public eligibleSwapPathsBySymbol;\\n\\n address public dexRouterAddress;\\n\\n address[] public poolAddresses;\\n string[] public tokenSymbolsForPaths;\\n address[][] public paths;\\n\\n // user => (token => amount)\\n mapping(address => mapping(address => uint256)) public balances;\\n}\\n\",\"keccak256\":\"0xd505f00a17446ca29983779a8febff10114173db7f47ca4300d6a0bfce6b957a\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IToucanCarbonOffsets.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\\\";\\n\\nimport \\\"../types/CarbonProjectTypes.sol\\\";\\nimport \\\"../types/CarbonProjectVintageTypes.sol\\\";\\n\\ninterface IToucanCarbonOffsets is IERC20Upgradeable, IERC721Receiver {\\n function getGlobalProjectVintageIdentifiers()\\n external\\n view\\n returns (string memory, string memory);\\n\\n function getAttributes()\\n external\\n view\\n returns (ProjectData memory, VintageData memory);\\n\\n function getRemaining() external view returns (uint256 remaining);\\n\\n function getDepositCap() external view returns (uint256);\\n\\n function retire(uint256 amount) external;\\n\\n function retireFrom(address account, uint256 amount) external;\\n\\n function mintCertificateLegacy(\\n string calldata retiringEntityString,\\n address beneficiary,\\n string calldata beneficiaryString,\\n string calldata retirementMessage,\\n uint256 amount\\n ) external;\\n\\n function retireAndMintCertificate(\\n string calldata retiringEntityString,\\n address beneficiary,\\n string calldata beneficiaryString,\\n string calldata retirementMessage,\\n uint256 amount\\n ) external;\\n}\\n\",\"keccak256\":\"0x46c4ed2acd84764d0dd68c9c475e2c6ec3229a686046db48aca77ccd298d4b48\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/IToucanContractRegistry.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\npragma solidity ^0.8.0;\\n\\ninterface IToucanContractRegistry {\\n function carbonOffsetBatchesAddress() external view returns (address);\\n\\n function carbonProjectsAddress() external view returns (address);\\n\\n function carbonProjectVintagesAddress() external view returns (address);\\n\\n function toucanCarbonOffsetsFactoryAddress()\\n external\\n view\\n returns (address);\\n\\n function carbonOffsetBadgesAddress() external view returns (address);\\n\\n function checkERC20(address _address) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xa8451ff2527948e4eed26e97247b979212ccb3bd89506302b6c09ddbad392035\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/IToucanPoolToken.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\n\\ninterface IToucanPoolToken is IERC20Upgradeable {\\n function deposit(address erc20Addr, uint256 amount) external;\\n\\n function checkEligible(address erc20Addr) external view returns (bool);\\n\\n function checkAttributeMatching(address erc20Addr)\\n external\\n view\\n returns (bool);\\n\\n function calculateRedeemFees(\\n address[] memory tco2s,\\n uint256[] memory amounts\\n ) external view returns (uint256);\\n\\n function redeemMany(address[] memory tco2s, uint256[] memory amounts)\\n external;\\n\\n function redeemAuto(uint256 amount) external;\\n\\n function redeemAuto2(uint256 amount)\\n external\\n returns (address[] memory tco2s, uint256[] memory amounts);\\n\\n function getRemaining() external view returns (uint256);\\n\\n function getScoredTCO2s() external view returns (address[] memory);\\n}\\n\",\"keccak256\":\"0xef39949a81cf4ed78d789a1aac5c5860de1582be70de7435f1671931091d43a7\",\"license\":\"UNLICENSED\"},\"contracts/types/CarbonProjectTypes.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @dev CarbonProject related data and attributes\\nstruct ProjectData {\\n string projectId;\\n string standard;\\n string methodology;\\n string region;\\n string storageMethod;\\n string method;\\n string emissionType;\\n string category;\\n string uri;\\n address controller;\\n}\\n\",\"keccak256\":\"0x10d52f79d4bb8dbfe0abbb1662059d6d0193fe5794977b66aacf741451e25401\",\"license\":\"UNLICENSED\"},\"contracts/types/CarbonProjectVintageTypes.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\nstruct VintageData {\\n /// @dev A human-readable string which differentiates this from other vintages in\\n /// the same project, and helps build the corresponding TCO2 name and symbol.\\n string name;\\n uint64 startTime; // UNIX timestamp\\n uint64 endTime; // UNIX timestamp\\n uint256 projectTokenId;\\n uint64 totalVintageQuantity;\\n bool isCorsiaCompliant;\\n bool isCCPcompliant;\\n string coBenefits;\\n string correspAdjustment;\\n string additionalCertification;\\n string uri;\\n}\\n\",\"keccak256\":\"0x3a52e88a48b87f1ca3992c201f8b786ccf3aeb74796510893f8e33b33eae251b\",\"license\":\"UNLICENSED\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506040516200416338038062004163833981016040819052620000349162000585565b606780546001600160a01b0319166001600160a01b038316179055835162000064906068906020870190620001fd565b5082516200007a90606990602086019062000267565b5081516200009090606a906020850190620002c7565b5082516000905b80821015620001f157838281518110620000c157634e487b7160e01b600052603260045260246000fd5b602002602001015160656000868581518110620000ee57634e487b7160e01b600052603260045260246000fd5b60200260200101516000815181106200011757634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020908051906020019062000154929190620001fd565b508382815181106200017657634e487b7160e01b600052603260045260246000fd5b60200260200101516066868481518110620001a157634e487b7160e01b600052603260045260246000fd5b6020026020010151604051620001b89190620006fc565b90815260200160405180910390209080519060200190620001db929190620001fd565b50620001e960018362000773565b915062000097565b5050505050506200081e565b82805482825590600052602060002090810192821562000255579160200282015b828111156200025557825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906200021e565b506200026392915062000327565b5090565b828054828255906000526020600020908101928215620002b9579160200282015b82811115620002b95782518051620002a89184916020909101906200033e565b509160200191906001019062000288565b5062000263929150620003bb565b82805482825590600052602060002090810192821562000319579160200282015b8281111562000319578251805162000308918491602090910190620001fd565b5091602001919060010190620002e8565b5062000263929150620003dc565b5b8082111562000263576000815560010162000328565b8280546200034c90620007cb565b90600052602060002090601f01602090048101928262000370576000855562000255565b82601f106200038b57805160ff191683800117855562000255565b8280016001018555821562000255579182015b82811115620002555782518255916020019190600101906200039e565b8082111562000263576000620003d28282620003fd565b50600101620003bb565b8082111562000263576000620003f382826200043f565b50600101620003dc565b5080546200040b90620007cb565b6000825580601f106200041c575050565b601f0160209004906000526020600020908101906200043c919062000327565b50565b50805460008255906000526020600020908101906200043c919062000327565b80516001600160a01b03811681146200047757600080fd5b919050565b600082601f8301126200048d578081fd5b81516020620004a6620004a0836200074d565b6200071a565b80838252828201915082860187848660051b8901011115620004c6578586fd5b855b85811015620004ef57620004dc826200045f565b84529284019290840190600101620004c8565b5090979650505050505050565b600082601f8301126200050d578081fd5b8151602062000520620004a0836200074d565b80838252828201915082860187848660051b890101111562000540578586fd5b855b85811015620004ef5781516001600160401b0381111562000561578788fd5b620005718a87838c01016200047c565b855250928401929084019060010162000542565b600080600080608085870312156200059b578384fd5b84516001600160401b0380821115620005b2578586fd5b620005c0888389016200047c565b95506020870151915080821115620005d6578485fd5b818701915087601f830112620005ea578485fd5b8151620005fb620004a0826200074d565b80828252602082019150602085018b60208560051b88010111156200061e578889fd5b885b84811015620006b65781518681111562000638578a8bfd5b8701603f81018e1362000649578a8bfd5b60208101518781111562000661576200066162000808565b62000676601f8201601f19166020016200071a565b8181528f60408385010111156200068b578c8dfd5b6200069e82602083016040860162000798565b86525050602093840193919091019060010162000620565b505060408a01519097509350505080821115620006d1578384fd5b50620006e087828801620004fc565b925050620006f1606086016200045f565b905092959194509250565b600082516200071081846020870162000798565b9190910192915050565b604051601f8201601f191681016001600160401b038111828210171562000745576200074562000808565b604052919050565b60006001600160401b0382111562000769576200076962000808565b5060051b60200190565b600082198211156200079357634e487b7160e01b81526011600452602481fd5b500190565b60005b83811015620007b55781810151838201526020016200079b565b83811115620007c5576000848401525b50505050565b600181811c90821680620007e057607f821691505b602082108114156200080257634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b613935806200082e6000396000f3fe6080604052600436106101e55760003560e01c80638da5cb5b11610101578063c23f001f1161009a578063e7f67fb11161006c578063e7f67fb1146105ca578063f04ad9d7146105ea578063f2fde38b146105fd578063f3fef3a31461061d578063feb21b9c1461063d57005b8063c23f001f1461053f578063c6c53efb14610577578063d08ec47514610597578063d8a90c40146105b757005b8063a2844a86116100d3578063a2844a86146104af578063b4e76a86146104df578063b8baf9db146104ff578063c0681c3d1461051f57005b80638da5cb5b146104315780639753209d1461044f578063a09457221461046f578063a0cd60491461048f57005b80635367cd9c1161017e578063715018a611610150578063715018a6146103a757806373200b11146103bc5780638129fc1c146103dc57806382155e7e146103f15780638474c2881461041157005b80635367cd9c1461031a57806356a7de0d1461032d57806368d306d91461034d5780636d4565041461037a57005b80632e98c814116101b75780632e98c8141461029957806335bab7e5146102ba57806347e7ef24146102da5780634865b2b4146102fa57005b80631109ec99146101ee5780631357b113146102215780631661f818146102595780631a0fdecc1461027957005b366101ec57005b005b3480156101fa57600080fd5b5061020e6102093660046131f5565b61065d565b6040519081526020015b60405180910390f35b34801561022d57600080fd5b5061024161023c3660046131f5565b610753565b6040516001600160a01b039091168152602001610218565b34801561026557600080fd5b506101ec610274366004613220565b61078b565b34801561028557600080fd5b5061020e6102943660046131b5565b610a7d565b6102ac6102a73660046131f5565b610b10565b6040516102189291906135f2565b3480156102c657600080fd5b5061020e6102d53660046131b5565b610b5f565b3480156102e657600080fd5b506101ec6102f53660046131f5565b610d0a565b34801561030657600080fd5b5061020e6103153660046131b5565b610d82565b6101ec6103283660046131f5565b610e0d565b34801561033957600080fd5b506101ec61034836600461315a565b6110bd565b34801561035957600080fd5b5061036d61036836600461315a565b611209565b60405161021891906135df565b34801561038657600080fd5b5061039a6103953660046134c2565b61127f565b6040516102189190613655565b3480156103b357600080fd5b506101ec61132b565b3480156103c857600080fd5b506102416103d736600461347f565b61133f565b3480156103e857600080fd5b506101ec61136a565b3480156103fd57600080fd5b506102ac61040c3660046131f5565b61147b565b34801561041d57600080fd5b506101ec61042c3660046131b5565b6116e7565b34801561043d57600080fd5b506033546001600160a01b0316610241565b34801561045b57600080fd5b506101ec61046a3660046133f5565b6119ab565b34801561047b57600080fd5b506102ac61048a3660046131b5565b611a4c565b34801561049b57600080fd5b506102ac6104aa3660046131b5565b611a80565b3480156104bb57600080fd5b506104cf6104ca36600461315a565b611aaf565b6040519015158152602001610218565b3480156104eb57600080fd5b5061020e6104fa3660046131f5565b611ac0565b34801561050b57600080fd5b506101ec61051a366004613428565b611ba6565b34801561052b57600080fd5b506101ec61053a36600461315a565b611c8b565b34801561054b57600080fd5b5061020e61055a36600461317d565b606b60209081526000928352604080842090915290825290205481565b34801561058357600080fd5b506102416105923660046134f2565b611ce5565b3480156105a357600080fd5b506102ac6105b23660046131f5565b611d0d565b61020e6105c536600461315a565b611d1a565b3480156105d657600080fd5b50606754610241906001600160a01b031681565b6102ac6105f836600461315a565b611eec565b34801561060957600080fd5b506101ec61061836600461315a565b611f3d565b34801561062957600080fd5b506101ec6106383660046131f5565b611fb3565b34801561064957600080fd5b506102416106583660046134c2565b61206d565b600061a4ec46141561068a5760405162461bcd60e51b815260040161068190613688565b60405180910390fd5b8261069481612097565b6106b05760405162461bcd60e51b81526004016106819061370d565b600060666040516106cd9065574d4154494360d01b815260060190565b90815260200160405180910390206000815481106106fb57634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b0316915061071c82878761210f565b9150508060008151811061074057634e487b7160e01b600052603260045260246000fd5b6020026020010151935050505092915050565b6065602052816000526040600020818154811061076f57600080fd5b6000918252602090912001546001600160a01b03169150829050565b8151806107c85760405162461bcd60e51b815260206004820152600b60248201526a417272617920656d70747960a81b6044820152606401610681565b815181146107e85760405162461bcd60e51b81526004016106819061373b565b60005b81811015610a775782818151811061081357634e487b7160e01b600052603260045260246000fd5b60200260200101516000141561082b576001016107eb565b82818151811061084b57634e487b7160e01b600052603260045260246000fd5b6020026020010151606b6000336001600160a01b03166001600160a01b03168152602001908152602001600020600086848151811061089a57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000205410156109115760405162461bcd60e51b815260206004820152601960248201527f496e73756666696369656e742054434f322062616c616e6365000000000000006044820152606401610681565b82818151811061093157634e487b7160e01b600052603260045260246000fd5b6020026020010151606b6000336001600160a01b03166001600160a01b03168152602001908152602001600020600086848151811061098057634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060008282546109b79190613825565b925050819055508381815181106109de57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316633790cf57848381518110610a1457634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b8152600401610a3a91815260200190565b600060405180830381600087803b158015610a5457600080fd5b505af1158015610a68573d6000803e3d6000fd5b505050508060010190506107eb565b50505050565b600083610a898161224f565b610aa55760405162461bcd60e51b8152600401610681906136d6565b83610aaf81612097565b610acb5760405162461bcd60e51b81526004016106819061370d565b6000610ad887878761210f565b91505080600081518110610afc57634e487b7160e01b600052603260045260246000fd5b602002602001015193505050509392505050565b60608061a4ec461415610b355760405162461bcd60e51b815260040161068190613688565b610b3f8484610e0d565b610b49848461147b565b9092509050610b58828261078b565b9250929050565b600083610b6b8161224f565b610b875760405162461bcd60e51b8152600401610681906136d6565b83610b9181612097565b610bad5760405162461bcd60e51b81526004016106819061370d565b6000610bb987876122e8565b8051909150610bd36001600160a01b03891633308961289a565b606754610bed906001600160a01b038a8116911688612905565b6000610c016067546001600160a01b031690565b6001600160a01b03166338ed17398860008630426040518663ffffffff1660e01b8152600401610c3595949392919061377c565b600060405180830381600087803b158015610c4f57600080fd5b505af1158015610c63573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c8b91908101906133a2565b905080610c99600184613825565b81518110610cb757634e487b7160e01b600052603260045260246000fd5b602090810291909101810151336000908152606b835260408082206001600160a01b038d168352909352918220805491985088929091610cf890849061380d565b90915550959998505050505050505050565b81610d1481612097565b610d305760405162461bcd60e51b81526004016106819061370d565b610d456001600160a01b03841633308561289a565b336000908152606b602090815260408083206001600160a01b038716845290915281208054849290610d7890849061380d565b9091555050505050565b600083610d8e8161224f565b610daa5760405162461bcd60e51b8152600401610681906136d6565b83610db481612097565b610dd05760405162461bcd60e51b81526004016106819061370d565b6000610ddd878787612a29565b9150508060018251610def9190613825565b81518110610afc57634e487b7160e01b600052603260045260246000fd5b61a4ec461415610e2f5760405162461bcd60e51b815260040161068190613688565b81610e3981612097565b610e555760405162461bcd60e51b81526004016106819061370d565b60006066604051610e729065574d4154494360d01b815260060190565b9081526020016040518091039020600081548110610ea057634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b03169150610ec082866122e8565b90506000610ed66067546001600160a01b031690565b6001600160a01b031663fb3bdb4134878530426040518663ffffffff1660e01b8152600401610f089493929190613620565b6000604051808303818588803b158015610f2157600080fd5b505af1158015610f35573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052610f5e91908101906133a2565b905080600081518110610f8157634e487b7160e01b600052603260045260246000fd5b602002602001015134111561107d57600081600081518110610fb357634e487b7160e01b600052603260045260246000fd5b602002602001015134610fc69190613825565b604080516000808252602082019283905292935033918491610fe791613585565b60006040518083038185875af1925050503d8060008114611024576040519150601f19603f3d011682016040523d82523d6000602084013e611029565b606091505b505090508061107a5760405162461bcd60e51b815260206004820152601b60248201527f4661696c656420746f2073656e6420737572706c7573206261636b00000000006044820152606401610681565b50505b336000908152606b602090815260408083206001600160a01b038a168452909152812080548792906110b090849061380d565b9091555050505050505050565b6110c5612b5f565b60005b60685481101561120557816001600160a01b0316606882815481106110fd57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156111f3576068805461112890600190613825565b8154811061114657634e487b7160e01b600052603260045260246000fd5b600091825260209091200154606880546001600160a01b03909216918390811061118057634e487b7160e01b600052603260045260246000fd5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060688054806111cd57634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b03191690550190555050565b806111fd816138a3565b9150506110c8565b5050565b6001600160a01b03811660009081526065602090815260409182902080548351818402810184019094528084526060939283018282801561127357602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611255575b50505050509050919050565b6069818154811061128f57600080fd5b9060005260206000200160009150905080546112aa90613868565b80601f01602080910402602001604051908101604052809291908181526020018280546112d690613868565b80156113235780601f106112f857610100808354040283529160200191611323565b820191906000526020600020905b81548152906001019060200180831161130657829003601f168201915b505050505081565b611333612b5f565b61133d6000612bb9565b565b8151602081840181018051606682529282019185019190912091905280548290811061076f57600080fd5b600054610100900460ff161580801561138a5750600054600160ff909116105b806113a45750303b1580156113a4575060005460ff166001145b6114075760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610681565b6000805460ff19166001179055801561142a576000805461ff0019166101001790555b611432612c0b565b8015611478576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50565b6060808361148881612097565b6114a45760405162461bcd60e51b81526004016106819061370d565b336000908152606b602090815260408083206001600160a01b03891684529091529020548411156115175760405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e74204e43542f4243542062616c616e6365000000006044820152606401610681565b604051634c02cad160e01b81526004810185905285906001600160a01b03821690634c02cad190602401600060405180830381600087803b15801561155b57600080fd5b505af115801561156f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261159791908101906132dc565b336000908152606b602090815260408083206001600160a01b038c1684529091528120805493975091955087926115cf908490613825565b9091555050835160005b8181101561169f5784818151811061160157634e487b7160e01b600052603260045260246000fd5b6020026020010151606b6000336001600160a01b03166001600160a01b03168152602001908152602001600020600088848151811061165057634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206000828254611687919061380d565b90915550819050611697816138a3565b9150506115d9565b507f3d29f82a20ec733db9f357c4dc1ae0ee60c572cc4b877384aa4639e4d877b188338887876040516116d594939291906135a1565b60405180910390a15050509250929050565b826116f18161224f565b61170d5760405162461bcd60e51b8152600401610681906136d6565b8261171781612097565b6117335760405162461bcd60e51b81526004016106819061370d565b60008061174187878761210f565b9150915060008160008151811061176857634e487b7160e01b600052603260045260246000fd5b6020908102919091010151905061178a6001600160a01b03891633308461289a565b60675460405163095ea7b360e01b81526001600160a01b039182166004820152602481018390529089169063095ea7b390604401602060405180830381600087803b1580156117d857600080fd5b505af11580156117ec573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061181091906133d5565b5060006118256067546001600160a01b031690565b6001600160a01b0316638803dbee88848730426040518663ffffffff1660e01b815260040161185895949392919061377c565b600060405180830381600087803b15801561187257600080fd5b505af1158015611886573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526118ae91908101906133a2565b905081816000815181106118d257634e487b7160e01b600052603260045260246000fd5b602002602001015110156119685760675460405163095ea7b360e01b81526001600160a01b03918216600482015260006024820152908a169063095ea7b390604401602060405180830381600087803b15801561192e57600080fd5b505af1158015611942573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061196691906133d5565b505b336000908152606b602090815260408083206001600160a01b038c1684529091528120805489929061199b90849061380d565b9091555050505050505050505050565b6119b3612b5f565b606560006066836040516119c79190613585565b90815260200160405180910390206000815481106119f557634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528201929092526040018120611a2291612f0e565b606681604051611a329190613585565b908152602001604051809103902060006114789190612f0e565b6060806000611a5c868686610b5f565b9050611a68858261147b565b9093509150611a77838361078b565b50935093915050565b606080611a8e8585856116e7565b611a98848461147b565b9092509050611aa7828261078b565b935093915050565b6000611aba82612097565b92915050565b600061a4ec461415611ae45760405162461bcd60e51b815260040161068190613688565b82611aee81612097565b611b0a5760405162461bcd60e51b81526004016106819061370d565b60006066604051611b279065574d4154494360d01b815260060190565b9081526020016040518091039020600081548110611b5557634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b03169150611b76828787612a29565b9150508060018251611b889190613825565b8151811061074057634e487b7160e01b600052603260045260246000fd5b611bae612b5f565b806065600083600081518110611bd457634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000209080519060200190611c0f929190612f2c565b5080606683604051611c219190613585565b90815260200160405180910390209080519060200190611c42929190612f2c565b50606980546001810182556000919091528251611c86917f7fb4302e8e91f9110a6554c2c0a24601252c2a42c2220ca988efcfe39991430801906020850190612f91565b505050565b611c93612b5f565b606880546001810182556000919091527fa2153420d844928b4421650203c77babc8b33d7f2e7b450e2966db0c220977530180546001600160a01b0319166001600160a01b0392909216919091179055565b606a8281548110611cf557600080fd5b90600052602060002001818154811061076f57600080fd5b606080610b3f8484610d0a565b600061a4ec461415611d3e5760405162461bcd60e51b815260040161068190613688565b81611d4881612097565b611d645760405162461bcd60e51b81526004016106819061370d565b60405165574d4154494360d01b815234906000906066906006019081526020016040518091039020600081548110611dac57634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b03169150611dcc82876122e8565b80519091506000611de56067546001600160a01b031690565b6001600160a01b0316637ff36ab58660008630426040518663ffffffff1660e01b8152600401611e189493929190613620565b6000604051808303818588803b158015611e3157600080fd5b505af1158015611e45573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052611e6e91908101906133a2565b905080611e7c600184613825565b81518110611e9a57634e487b7160e01b600052603260045260246000fd5b602090810291909101810151336000908152606b835260408082206001600160a01b038d168352909352918220805491995089929091611edb90849061380d565b909155509698975050505050505050565b60608061a4ec461415611f115760405162461bcd60e51b815260040161068190613688565b6000611f1c84611d1a565b9050611f28848261147b565b9093509150611f37838361078b565b50915091565b611f45612b5f565b6001600160a01b038116611faa5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610681565b61147881612bb9565b336000908152606b602090815260408083206001600160a01b038616845290915290205481111561201d5760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b6044820152606401610681565b6120316001600160a01b0383163383612c7f565b336000908152606b602090815260408083206001600160a01b038616845290915281208054839290612064908490613825565b90915550505050565b6068818154811061207d57600080fd5b6000918252602090912001546001600160a01b0316905081565b6000805b60685481101561210657826001600160a01b0316606882815481106120d057634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156120f45750600192915050565b806120fe816138a3565b91505061209b565b50600092915050565b60608061211c85856122e8565b80519092506121336067546001600160a01b031690565b6001600160a01b0316631f00ca7485856040518363ffffffff1660e01b8152600401612160929190613763565b60006040518083038186803b15801561217857600080fd5b505afa15801561218c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526121b491908101906133a2565b9150815181146121d65760405162461bcd60e51b81526004016106819061373b565b816121e2600183613825565b8151811061220057634e487b7160e01b600052603260045260246000fd5b60200260200101518414611a775760405162461bcd60e51b815260206004820152601660248201527509eeae8e0eae840c2dadeeadce840dad2e6dac2e8c6d60531b6044820152606401610681565b6000805b606a5481101561210657826001600160a01b0316606a828154811061228857634e487b7160e01b600052603260045260246000fd5b906000526020600020016000815481106122b257634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156122d65750600192915050565b806122e0816138a3565b915050612253565b6001600160a01b03821660009081526065602052604090205460609060018114156123b7576040805160028082526060820183529091602083019080368337019050509150838260008151811061234f57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050828260018151811061239157634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505050611aba565b80600214156124d057604080516003808252608082019092529060208201606080368337019050509150838260008151811061240357634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600190811061244f57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260018151811061248e57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050828260028151811061239157634e487b7160e01b600052603260045260246000fd5b806003141561267457604080516003808252608082019092529060208201606080368337019050509150838260008151811061251c57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600190811061256857634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826001815181106125a757634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092018101919091529085166000908152606590915260409020805460029081106125f357634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260028151811061263257634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050828260038151811061239157634e487b7160e01b600052603260045260246000fd5b60408051600480825260a08201909252906020820160808036833701905050915083826000815181106126b757634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600190811061270357634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260018151811061274257634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600290811061278e57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826002815181106127cd57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600390811061281957634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260038151811061285857634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050828260048151811061239157634e487b7160e01b600052603260045260246000fd5b6040516001600160a01b0380851660248301528316604482015260648101829052610a779085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612caf565b80158061298e5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561295457600080fd5b505afa158015612968573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061298c91906134da565b155b6129f95760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610681565b6040516001600160a01b038316602482015260448101829052611c8690849063095ea7b360e01b906064016128ce565b606080612a3685856122e8565b8051909250612a4d6067546001600160a01b031690565b6001600160a01b031663d06ca61f85856040518363ffffffff1660e01b8152600401612a7a929190613763565b60006040518083038186803b158015612a9257600080fd5b505afa158015612aa6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612ace91908101906133a2565b915081518114612af05760405162461bcd60e51b81526004016106819061373b565b81600081518110612b1157634e487b7160e01b600052603260045260246000fd5b60200260200101518414611a775760405162461bcd60e51b8152602060048201526015602482015274092dce0eae840c2dadeeadce840dad2e6dac2e8c6d605b1b6044820152606401610681565b6033546001600160a01b0316331461133d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610681565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16612c765760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610681565b61133d33612bb9565b6040516001600160a01b038316602482015260448101829052611c8690849063a9059cbb60e01b906064016128ce565b6000612d04826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612d819092919063ffffffff16565b805190915015611c865780806020019051810190612d2291906133d5565b611c865760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610681565b6060612d908484600085612d98565b949350505050565b606082471015612df95760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610681565b600080866001600160a01b03168587604051612e159190613585565b60006040518083038185875af1925050503d8060008114612e52576040519150601f19603f3d011682016040523d82523d6000602084013e612e57565b606091505b5091509150612e6887838387612e73565b979650505050505050565b60608315612edf578251612ed8576001600160a01b0385163b612ed85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610681565b5081612d90565b612d908383815115612ef45781518083602001fd5b8060405162461bcd60e51b81526004016106819190613655565b50805460008255906000526020600020908101906114789190613005565b828054828255906000526020600020908101928215612f81579160200282015b82811115612f8157825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190612f4c565b50612f8d929150613005565b5090565b828054612f9d90613868565b90600052602060002090601f016020900481019282612fbf5760008555612f81565b82601f10612fd857805160ff1916838001178555612f81565b82800160010185558215612f81579182015b82811115612f81578251825591602001919060010190612fea565b5b80821115612f8d5760008155600101613006565b600082601f83011261302a578081fd5b8135602061303f61303a836137e9565b6137b8565b80838252828201915082860187848660051b890101111561305e578586fd5b855b85811015613085578135613073816138ea565b84529284019290840190600101613060565b5090979650505050505050565b600082601f8301126130a2578081fd5b815160206130b261303a836137e9565b80838252828201915082860187848660051b89010111156130d1578586fd5b855b85811015613085578151845292840192908401906001016130d3565b600082601f8301126130ff578081fd5b813567ffffffffffffffff811115613119576131196138d4565b61312c601f8201601f19166020016137b8565b818152846020838601011115613140578283fd5b816020850160208301379081016020019190915292915050565b60006020828403121561316b578081fd5b8135613176816138ea565b9392505050565b6000806040838503121561318f578081fd5b823561319a816138ea565b915060208301356131aa816138ea565b809150509250929050565b6000806000606084860312156131c9578081fd5b83356131d4816138ea565b925060208401356131e4816138ea565b929592945050506040919091013590565b60008060408385031215613207578182fd5b8235613212816138ea565b946020939093013593505050565b60008060408385031215613232578182fd5b823567ffffffffffffffff80821115613249578384fd5b6132558683870161301a565b935060209150818501358181111561326b578384fd5b85019050601f8101861361327d578283fd5b803561328b61303a826137e9565b80828252848201915084840189868560051b87010111156132aa578687fd5b8694505b838510156132cc5780358352600194909401939185019185016132ae565b5080955050505050509250929050565b600080604083850312156132ee578182fd5b825167ffffffffffffffff80821115613305578384fd5b818501915085601f830112613318578384fd5b8151602061332861303a836137e9565b8083825282820191508286018a848660051b8901011115613347578889fd5b8896505b8487101561337257805161335e816138ea565b83526001969096019591830191830161334b565b509188015191965090935050508082111561338b578283fd5b5061339885828601613092565b9150509250929050565b6000602082840312156133b3578081fd5b815167ffffffffffffffff8111156133c9578182fd5b612d9084828501613092565b6000602082840312156133e6578081fd5b81518015158114613176578182fd5b600060208284031215613406578081fd5b813567ffffffffffffffff81111561341c578182fd5b612d90848285016130ef565b6000806040838503121561343a578182fd5b823567ffffffffffffffff80821115613451578384fd5b61345d868387016130ef565b93506020850135915080821115613472578283fd5b506133988582860161301a565b60008060408385031215613491578182fd5b823567ffffffffffffffff8111156134a7578283fd5b6134b3858286016130ef565b95602094909401359450505050565b6000602082840312156134d3578081fd5b5035919050565b6000602082840312156134eb578081fd5b5051919050565b60008060408385031215613504578182fd5b50508035926020909101359150565b6000815180845260208085019450808401835b8381101561354b5781516001600160a01b031687529582019590820190600101613526565b509495945050505050565b6000815180845260208085019450808401835b8381101561354b57815187529582019590820190600101613569565b6000825161359781846020870161383c565b9190910192915050565b6001600160a01b038581168252841660208201526080604082018190526000906135cd90830185613513565b8281036060840152612e688185613556565b6020815260006131766020830184613513565b6040815260006136056040830185613513565b82810360208401526136178185613556565b95945050505050565b8481526080602082015260006136396080830186613513565b6001600160a01b03949094166040830152506060015292915050565b602081526000825180602084015261367481604085016020870161383c565b601f01601f19169190910160400192915050565b6020808252602e908201527f5468652066756e6374696f6e206973206e6f7420617661696c61626c65206f6e60408201526d103a3434b9903732ba3bb7b9359760911b606082015260800190565b60208082526018908201527f5061746820646f65736e277420796574206578697374732e0000000000000000604082015260600190565b602080825260149082015273546f6b656e206e6f742072656465656d61626c6560601b604082015260600190565b6020808252600e908201526d105c9c985e5cc81d5b995c5d585b60921b604082015260600190565b828152604060208201526000612d906040830184613513565b85815284602082015260a06040820152600061379b60a0830186613513565b6001600160a01b0394909416606083015250608001529392505050565b604051601f8201601f1916810167ffffffffffffffff811182821017156137e1576137e16138d4565b604052919050565b600067ffffffffffffffff821115613803576138036138d4565b5060051b60200190565b60008219821115613820576138206138be565b500190565b600082821015613837576138376138be565b500390565b60005b8381101561385757818101518382015260200161383f565b83811115610a775750506000910152565b600181811c9082168061387c57607f821691505b6020821081141561389d57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156138b7576138b76138be565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461147857600080fdfea26469706673582212200f2bb74b64168c68a4845864d66a79cf1c4ab79c19c33d5a3cd70163e4a3de7564736f6c63430008040033", - "deployedBytecode": "0x6080604052600436106101e55760003560e01c80638da5cb5b11610101578063c23f001f1161009a578063e7f67fb11161006c578063e7f67fb1146105ca578063f04ad9d7146105ea578063f2fde38b146105fd578063f3fef3a31461061d578063feb21b9c1461063d57005b8063c23f001f1461053f578063c6c53efb14610577578063d08ec47514610597578063d8a90c40146105b757005b8063a2844a86116100d3578063a2844a86146104af578063b4e76a86146104df578063b8baf9db146104ff578063c0681c3d1461051f57005b80638da5cb5b146104315780639753209d1461044f578063a09457221461046f578063a0cd60491461048f57005b80635367cd9c1161017e578063715018a611610150578063715018a6146103a757806373200b11146103bc5780638129fc1c146103dc57806382155e7e146103f15780638474c2881461041157005b80635367cd9c1461031a57806356a7de0d1461032d57806368d306d91461034d5780636d4565041461037a57005b80632e98c814116101b75780632e98c8141461029957806335bab7e5146102ba57806347e7ef24146102da5780634865b2b4146102fa57005b80631109ec99146101ee5780631357b113146102215780631661f818146102595780631a0fdecc1461027957005b366101ec57005b005b3480156101fa57600080fd5b5061020e6102093660046131f5565b61065d565b6040519081526020015b60405180910390f35b34801561022d57600080fd5b5061024161023c3660046131f5565b610753565b6040516001600160a01b039091168152602001610218565b34801561026557600080fd5b506101ec610274366004613220565b61078b565b34801561028557600080fd5b5061020e6102943660046131b5565b610a7d565b6102ac6102a73660046131f5565b610b10565b6040516102189291906135f2565b3480156102c657600080fd5b5061020e6102d53660046131b5565b610b5f565b3480156102e657600080fd5b506101ec6102f53660046131f5565b610d0a565b34801561030657600080fd5b5061020e6103153660046131b5565b610d82565b6101ec6103283660046131f5565b610e0d565b34801561033957600080fd5b506101ec61034836600461315a565b6110bd565b34801561035957600080fd5b5061036d61036836600461315a565b611209565b60405161021891906135df565b34801561038657600080fd5b5061039a6103953660046134c2565b61127f565b6040516102189190613655565b3480156103b357600080fd5b506101ec61132b565b3480156103c857600080fd5b506102416103d736600461347f565b61133f565b3480156103e857600080fd5b506101ec61136a565b3480156103fd57600080fd5b506102ac61040c3660046131f5565b61147b565b34801561041d57600080fd5b506101ec61042c3660046131b5565b6116e7565b34801561043d57600080fd5b506033546001600160a01b0316610241565b34801561045b57600080fd5b506101ec61046a3660046133f5565b6119ab565b34801561047b57600080fd5b506102ac61048a3660046131b5565b611a4c565b34801561049b57600080fd5b506102ac6104aa3660046131b5565b611a80565b3480156104bb57600080fd5b506104cf6104ca36600461315a565b611aaf565b6040519015158152602001610218565b3480156104eb57600080fd5b5061020e6104fa3660046131f5565b611ac0565b34801561050b57600080fd5b506101ec61051a366004613428565b611ba6565b34801561052b57600080fd5b506101ec61053a36600461315a565b611c8b565b34801561054b57600080fd5b5061020e61055a36600461317d565b606b60209081526000928352604080842090915290825290205481565b34801561058357600080fd5b506102416105923660046134f2565b611ce5565b3480156105a357600080fd5b506102ac6105b23660046131f5565b611d0d565b61020e6105c536600461315a565b611d1a565b3480156105d657600080fd5b50606754610241906001600160a01b031681565b6102ac6105f836600461315a565b611eec565b34801561060957600080fd5b506101ec61061836600461315a565b611f3d565b34801561062957600080fd5b506101ec6106383660046131f5565b611fb3565b34801561064957600080fd5b506102416106583660046134c2565b61206d565b600061a4ec46141561068a5760405162461bcd60e51b815260040161068190613688565b60405180910390fd5b8261069481612097565b6106b05760405162461bcd60e51b81526004016106819061370d565b600060666040516106cd9065574d4154494360d01b815260060190565b90815260200160405180910390206000815481106106fb57634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b0316915061071c82878761210f565b9150508060008151811061074057634e487b7160e01b600052603260045260246000fd5b6020026020010151935050505092915050565b6065602052816000526040600020818154811061076f57600080fd5b6000918252602090912001546001600160a01b03169150829050565b8151806107c85760405162461bcd60e51b815260206004820152600b60248201526a417272617920656d70747960a81b6044820152606401610681565b815181146107e85760405162461bcd60e51b81526004016106819061373b565b60005b81811015610a775782818151811061081357634e487b7160e01b600052603260045260246000fd5b60200260200101516000141561082b576001016107eb565b82818151811061084b57634e487b7160e01b600052603260045260246000fd5b6020026020010151606b6000336001600160a01b03166001600160a01b03168152602001908152602001600020600086848151811061089a57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000205410156109115760405162461bcd60e51b815260206004820152601960248201527f496e73756666696369656e742054434f322062616c616e6365000000000000006044820152606401610681565b82818151811061093157634e487b7160e01b600052603260045260246000fd5b6020026020010151606b6000336001600160a01b03166001600160a01b03168152602001908152602001600020600086848151811061098057634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060008282546109b79190613825565b925050819055508381815181106109de57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316633790cf57848381518110610a1457634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b8152600401610a3a91815260200190565b600060405180830381600087803b158015610a5457600080fd5b505af1158015610a68573d6000803e3d6000fd5b505050508060010190506107eb565b50505050565b600083610a898161224f565b610aa55760405162461bcd60e51b8152600401610681906136d6565b83610aaf81612097565b610acb5760405162461bcd60e51b81526004016106819061370d565b6000610ad887878761210f565b91505080600081518110610afc57634e487b7160e01b600052603260045260246000fd5b602002602001015193505050509392505050565b60608061a4ec461415610b355760405162461bcd60e51b815260040161068190613688565b610b3f8484610e0d565b610b49848461147b565b9092509050610b58828261078b565b9250929050565b600083610b6b8161224f565b610b875760405162461bcd60e51b8152600401610681906136d6565b83610b9181612097565b610bad5760405162461bcd60e51b81526004016106819061370d565b6000610bb987876122e8565b8051909150610bd36001600160a01b03891633308961289a565b606754610bed906001600160a01b038a8116911688612905565b6000610c016067546001600160a01b031690565b6001600160a01b03166338ed17398860008630426040518663ffffffff1660e01b8152600401610c3595949392919061377c565b600060405180830381600087803b158015610c4f57600080fd5b505af1158015610c63573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c8b91908101906133a2565b905080610c99600184613825565b81518110610cb757634e487b7160e01b600052603260045260246000fd5b602090810291909101810151336000908152606b835260408082206001600160a01b038d168352909352918220805491985088929091610cf890849061380d565b90915550959998505050505050505050565b81610d1481612097565b610d305760405162461bcd60e51b81526004016106819061370d565b610d456001600160a01b03841633308561289a565b336000908152606b602090815260408083206001600160a01b038716845290915281208054849290610d7890849061380d565b9091555050505050565b600083610d8e8161224f565b610daa5760405162461bcd60e51b8152600401610681906136d6565b83610db481612097565b610dd05760405162461bcd60e51b81526004016106819061370d565b6000610ddd878787612a29565b9150508060018251610def9190613825565b81518110610afc57634e487b7160e01b600052603260045260246000fd5b61a4ec461415610e2f5760405162461bcd60e51b815260040161068190613688565b81610e3981612097565b610e555760405162461bcd60e51b81526004016106819061370d565b60006066604051610e729065574d4154494360d01b815260060190565b9081526020016040518091039020600081548110610ea057634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b03169150610ec082866122e8565b90506000610ed66067546001600160a01b031690565b6001600160a01b031663fb3bdb4134878530426040518663ffffffff1660e01b8152600401610f089493929190613620565b6000604051808303818588803b158015610f2157600080fd5b505af1158015610f35573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052610f5e91908101906133a2565b905080600081518110610f8157634e487b7160e01b600052603260045260246000fd5b602002602001015134111561107d57600081600081518110610fb357634e487b7160e01b600052603260045260246000fd5b602002602001015134610fc69190613825565b604080516000808252602082019283905292935033918491610fe791613585565b60006040518083038185875af1925050503d8060008114611024576040519150601f19603f3d011682016040523d82523d6000602084013e611029565b606091505b505090508061107a5760405162461bcd60e51b815260206004820152601b60248201527f4661696c656420746f2073656e6420737572706c7573206261636b00000000006044820152606401610681565b50505b336000908152606b602090815260408083206001600160a01b038a168452909152812080548792906110b090849061380d565b9091555050505050505050565b6110c5612b5f565b60005b60685481101561120557816001600160a01b0316606882815481106110fd57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156111f3576068805461112890600190613825565b8154811061114657634e487b7160e01b600052603260045260246000fd5b600091825260209091200154606880546001600160a01b03909216918390811061118057634e487b7160e01b600052603260045260246000fd5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060688054806111cd57634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b03191690550190555050565b806111fd816138a3565b9150506110c8565b5050565b6001600160a01b03811660009081526065602090815260409182902080548351818402810184019094528084526060939283018282801561127357602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611255575b50505050509050919050565b6069818154811061128f57600080fd5b9060005260206000200160009150905080546112aa90613868565b80601f01602080910402602001604051908101604052809291908181526020018280546112d690613868565b80156113235780601f106112f857610100808354040283529160200191611323565b820191906000526020600020905b81548152906001019060200180831161130657829003601f168201915b505050505081565b611333612b5f565b61133d6000612bb9565b565b8151602081840181018051606682529282019185019190912091905280548290811061076f57600080fd5b600054610100900460ff161580801561138a5750600054600160ff909116105b806113a45750303b1580156113a4575060005460ff166001145b6114075760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610681565b6000805460ff19166001179055801561142a576000805461ff0019166101001790555b611432612c0b565b8015611478576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50565b6060808361148881612097565b6114a45760405162461bcd60e51b81526004016106819061370d565b336000908152606b602090815260408083206001600160a01b03891684529091529020548411156115175760405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e74204e43542f4243542062616c616e6365000000006044820152606401610681565b604051634c02cad160e01b81526004810185905285906001600160a01b03821690634c02cad190602401600060405180830381600087803b15801561155b57600080fd5b505af115801561156f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261159791908101906132dc565b336000908152606b602090815260408083206001600160a01b038c1684529091528120805493975091955087926115cf908490613825565b9091555050835160005b8181101561169f5784818151811061160157634e487b7160e01b600052603260045260246000fd5b6020026020010151606b6000336001600160a01b03166001600160a01b03168152602001908152602001600020600088848151811061165057634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206000828254611687919061380d565b90915550819050611697816138a3565b9150506115d9565b507f3d29f82a20ec733db9f357c4dc1ae0ee60c572cc4b877384aa4639e4d877b188338887876040516116d594939291906135a1565b60405180910390a15050509250929050565b826116f18161224f565b61170d5760405162461bcd60e51b8152600401610681906136d6565b8261171781612097565b6117335760405162461bcd60e51b81526004016106819061370d565b60008061174187878761210f565b9150915060008160008151811061176857634e487b7160e01b600052603260045260246000fd5b6020908102919091010151905061178a6001600160a01b03891633308461289a565b60675460405163095ea7b360e01b81526001600160a01b039182166004820152602481018390529089169063095ea7b390604401602060405180830381600087803b1580156117d857600080fd5b505af11580156117ec573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061181091906133d5565b5060006118256067546001600160a01b031690565b6001600160a01b0316638803dbee88848730426040518663ffffffff1660e01b815260040161185895949392919061377c565b600060405180830381600087803b15801561187257600080fd5b505af1158015611886573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526118ae91908101906133a2565b905081816000815181106118d257634e487b7160e01b600052603260045260246000fd5b602002602001015110156119685760675460405163095ea7b360e01b81526001600160a01b03918216600482015260006024820152908a169063095ea7b390604401602060405180830381600087803b15801561192e57600080fd5b505af1158015611942573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061196691906133d5565b505b336000908152606b602090815260408083206001600160a01b038c1684529091528120805489929061199b90849061380d565b9091555050505050505050505050565b6119b3612b5f565b606560006066836040516119c79190613585565b90815260200160405180910390206000815481106119f557634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528201929092526040018120611a2291612f0e565b606681604051611a329190613585565b908152602001604051809103902060006114789190612f0e565b6060806000611a5c868686610b5f565b9050611a68858261147b565b9093509150611a77838361078b565b50935093915050565b606080611a8e8585856116e7565b611a98848461147b565b9092509050611aa7828261078b565b935093915050565b6000611aba82612097565b92915050565b600061a4ec461415611ae45760405162461bcd60e51b815260040161068190613688565b82611aee81612097565b611b0a5760405162461bcd60e51b81526004016106819061370d565b60006066604051611b279065574d4154494360d01b815260060190565b9081526020016040518091039020600081548110611b5557634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b03169150611b76828787612a29565b9150508060018251611b889190613825565b8151811061074057634e487b7160e01b600052603260045260246000fd5b611bae612b5f565b806065600083600081518110611bd457634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000209080519060200190611c0f929190612f2c565b5080606683604051611c219190613585565b90815260200160405180910390209080519060200190611c42929190612f2c565b50606980546001810182556000919091528251611c86917f7fb4302e8e91f9110a6554c2c0a24601252c2a42c2220ca988efcfe39991430801906020850190612f91565b505050565b611c93612b5f565b606880546001810182556000919091527fa2153420d844928b4421650203c77babc8b33d7f2e7b450e2966db0c220977530180546001600160a01b0319166001600160a01b0392909216919091179055565b606a8281548110611cf557600080fd5b90600052602060002001818154811061076f57600080fd5b606080610b3f8484610d0a565b600061a4ec461415611d3e5760405162461bcd60e51b815260040161068190613688565b81611d4881612097565b611d645760405162461bcd60e51b81526004016106819061370d565b60405165574d4154494360d01b815234906000906066906006019081526020016040518091039020600081548110611dac57634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b03169150611dcc82876122e8565b80519091506000611de56067546001600160a01b031690565b6001600160a01b0316637ff36ab58660008630426040518663ffffffff1660e01b8152600401611e189493929190613620565b6000604051808303818588803b158015611e3157600080fd5b505af1158015611e45573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052611e6e91908101906133a2565b905080611e7c600184613825565b81518110611e9a57634e487b7160e01b600052603260045260246000fd5b602090810291909101810151336000908152606b835260408082206001600160a01b038d168352909352918220805491995089929091611edb90849061380d565b909155509698975050505050505050565b60608061a4ec461415611f115760405162461bcd60e51b815260040161068190613688565b6000611f1c84611d1a565b9050611f28848261147b565b9093509150611f37838361078b565b50915091565b611f45612b5f565b6001600160a01b038116611faa5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610681565b61147881612bb9565b336000908152606b602090815260408083206001600160a01b038616845290915290205481111561201d5760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b6044820152606401610681565b6120316001600160a01b0383163383612c7f565b336000908152606b602090815260408083206001600160a01b038616845290915281208054839290612064908490613825565b90915550505050565b6068818154811061207d57600080fd5b6000918252602090912001546001600160a01b0316905081565b6000805b60685481101561210657826001600160a01b0316606882815481106120d057634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156120f45750600192915050565b806120fe816138a3565b91505061209b565b50600092915050565b60608061211c85856122e8565b80519092506121336067546001600160a01b031690565b6001600160a01b0316631f00ca7485856040518363ffffffff1660e01b8152600401612160929190613763565b60006040518083038186803b15801561217857600080fd5b505afa15801561218c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526121b491908101906133a2565b9150815181146121d65760405162461bcd60e51b81526004016106819061373b565b816121e2600183613825565b8151811061220057634e487b7160e01b600052603260045260246000fd5b60200260200101518414611a775760405162461bcd60e51b815260206004820152601660248201527509eeae8e0eae840c2dadeeadce840dad2e6dac2e8c6d60531b6044820152606401610681565b6000805b606a5481101561210657826001600160a01b0316606a828154811061228857634e487b7160e01b600052603260045260246000fd5b906000526020600020016000815481106122b257634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156122d65750600192915050565b806122e0816138a3565b915050612253565b6001600160a01b03821660009081526065602052604090205460609060018114156123b7576040805160028082526060820183529091602083019080368337019050509150838260008151811061234f57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050828260018151811061239157634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505050611aba565b80600214156124d057604080516003808252608082019092529060208201606080368337019050509150838260008151811061240357634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600190811061244f57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260018151811061248e57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050828260028151811061239157634e487b7160e01b600052603260045260246000fd5b806003141561267457604080516003808252608082019092529060208201606080368337019050509150838260008151811061251c57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600190811061256857634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826001815181106125a757634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092018101919091529085166000908152606590915260409020805460029081106125f357634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260028151811061263257634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050828260038151811061239157634e487b7160e01b600052603260045260246000fd5b60408051600480825260a08201909252906020820160808036833701905050915083826000815181106126b757634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600190811061270357634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260018151811061274257634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600290811061278e57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826002815181106127cd57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526065909152604090208054600390811061281957634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260038151811061285857634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050828260048151811061239157634e487b7160e01b600052603260045260246000fd5b6040516001600160a01b0380851660248301528316604482015260648101829052610a779085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612caf565b80158061298e5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561295457600080fd5b505afa158015612968573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061298c91906134da565b155b6129f95760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610681565b6040516001600160a01b038316602482015260448101829052611c8690849063095ea7b360e01b906064016128ce565b606080612a3685856122e8565b8051909250612a4d6067546001600160a01b031690565b6001600160a01b031663d06ca61f85856040518363ffffffff1660e01b8152600401612a7a929190613763565b60006040518083038186803b158015612a9257600080fd5b505afa158015612aa6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612ace91908101906133a2565b915081518114612af05760405162461bcd60e51b81526004016106819061373b565b81600081518110612b1157634e487b7160e01b600052603260045260246000fd5b60200260200101518414611a775760405162461bcd60e51b8152602060048201526015602482015274092dce0eae840c2dadeeadce840dad2e6dac2e8c6d605b1b6044820152606401610681565b6033546001600160a01b0316331461133d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610681565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16612c765760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610681565b61133d33612bb9565b6040516001600160a01b038316602482015260448101829052611c8690849063a9059cbb60e01b906064016128ce565b6000612d04826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612d819092919063ffffffff16565b805190915015611c865780806020019051810190612d2291906133d5565b611c865760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610681565b6060612d908484600085612d98565b949350505050565b606082471015612df95760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610681565b600080866001600160a01b03168587604051612e159190613585565b60006040518083038185875af1925050503d8060008114612e52576040519150601f19603f3d011682016040523d82523d6000602084013e612e57565b606091505b5091509150612e6887838387612e73565b979650505050505050565b60608315612edf578251612ed8576001600160a01b0385163b612ed85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610681565b5081612d90565b612d908383815115612ef45781518083602001fd5b8060405162461bcd60e51b81526004016106819190613655565b50805460008255906000526020600020908101906114789190613005565b828054828255906000526020600020908101928215612f81579160200282015b82811115612f8157825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190612f4c565b50612f8d929150613005565b5090565b828054612f9d90613868565b90600052602060002090601f016020900481019282612fbf5760008555612f81565b82601f10612fd857805160ff1916838001178555612f81565b82800160010185558215612f81579182015b82811115612f81578251825591602001919060010190612fea565b5b80821115612f8d5760008155600101613006565b600082601f83011261302a578081fd5b8135602061303f61303a836137e9565b6137b8565b80838252828201915082860187848660051b890101111561305e578586fd5b855b85811015613085578135613073816138ea565b84529284019290840190600101613060565b5090979650505050505050565b600082601f8301126130a2578081fd5b815160206130b261303a836137e9565b80838252828201915082860187848660051b89010111156130d1578586fd5b855b85811015613085578151845292840192908401906001016130d3565b600082601f8301126130ff578081fd5b813567ffffffffffffffff811115613119576131196138d4565b61312c601f8201601f19166020016137b8565b818152846020838601011115613140578283fd5b816020850160208301379081016020019190915292915050565b60006020828403121561316b578081fd5b8135613176816138ea565b9392505050565b6000806040838503121561318f578081fd5b823561319a816138ea565b915060208301356131aa816138ea565b809150509250929050565b6000806000606084860312156131c9578081fd5b83356131d4816138ea565b925060208401356131e4816138ea565b929592945050506040919091013590565b60008060408385031215613207578182fd5b8235613212816138ea565b946020939093013593505050565b60008060408385031215613232578182fd5b823567ffffffffffffffff80821115613249578384fd5b6132558683870161301a565b935060209150818501358181111561326b578384fd5b85019050601f8101861361327d578283fd5b803561328b61303a826137e9565b80828252848201915084840189868560051b87010111156132aa578687fd5b8694505b838510156132cc5780358352600194909401939185019185016132ae565b5080955050505050509250929050565b600080604083850312156132ee578182fd5b825167ffffffffffffffff80821115613305578384fd5b818501915085601f830112613318578384fd5b8151602061332861303a836137e9565b8083825282820191508286018a848660051b8901011115613347578889fd5b8896505b8487101561337257805161335e816138ea565b83526001969096019591830191830161334b565b509188015191965090935050508082111561338b578283fd5b5061339885828601613092565b9150509250929050565b6000602082840312156133b3578081fd5b815167ffffffffffffffff8111156133c9578182fd5b612d9084828501613092565b6000602082840312156133e6578081fd5b81518015158114613176578182fd5b600060208284031215613406578081fd5b813567ffffffffffffffff81111561341c578182fd5b612d90848285016130ef565b6000806040838503121561343a578182fd5b823567ffffffffffffffff80821115613451578384fd5b61345d868387016130ef565b93506020850135915080821115613472578283fd5b506133988582860161301a565b60008060408385031215613491578182fd5b823567ffffffffffffffff8111156134a7578283fd5b6134b3858286016130ef565b95602094909401359450505050565b6000602082840312156134d3578081fd5b5035919050565b6000602082840312156134eb578081fd5b5051919050565b60008060408385031215613504578182fd5b50508035926020909101359150565b6000815180845260208085019450808401835b8381101561354b5781516001600160a01b031687529582019590820190600101613526565b509495945050505050565b6000815180845260208085019450808401835b8381101561354b57815187529582019590820190600101613569565b6000825161359781846020870161383c565b9190910192915050565b6001600160a01b038581168252841660208201526080604082018190526000906135cd90830185613513565b8281036060840152612e688185613556565b6020815260006131766020830184613513565b6040815260006136056040830185613513565b82810360208401526136178185613556565b95945050505050565b8481526080602082015260006136396080830186613513565b6001600160a01b03949094166040830152506060015292915050565b602081526000825180602084015261367481604085016020870161383c565b601f01601f19169190910160400192915050565b6020808252602e908201527f5468652066756e6374696f6e206973206e6f7420617661696c61626c65206f6e60408201526d103a3434b9903732ba3bb7b9359760911b606082015260800190565b60208082526018908201527f5061746820646f65736e277420796574206578697374732e0000000000000000604082015260600190565b602080825260149082015273546f6b656e206e6f742072656465656d61626c6560601b604082015260600190565b6020808252600e908201526d105c9c985e5cc81d5b995c5d585b60921b604082015260600190565b828152604060208201526000612d906040830184613513565b85815284602082015260a06040820152600061379b60a0830186613513565b6001600160a01b0394909416606083015250608001529392505050565b604051601f8201601f1916810167ffffffffffffffff811182821017156137e1576137e16138d4565b604052919050565b600067ffffffffffffffff821115613803576138036138d4565b5060051b60200190565b60008219821115613820576138206138be565b500190565b600082821015613837576138376138be565b500390565b60005b8381101561385757818101518382015260200161383f565b83811115610a775750506000910152565b600181811c9082168061387c57607f821691505b6020821081141561389d57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156138b7576138b76138be565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461147857600080fdfea26469706673582212200f2bb74b64168c68a4845864d66a79cf1c4ab79c19c33d5a3cd70163e4a3de7564736f6c63430008040033", + "numDeployments": 7, + "solcInputHash": "75278ec65526f1e0033cc879f57dc68d", + "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_poolAddresses\",\"type\":\"address[]\"},{\"internalType\":\"string[]\",\"name\":\"_tokenSymbolsForPaths\",\"type\":\"string[]\"},{\"internalType\":\"address[][]\",\"name\":\"_paths\",\"type\":\"address[][]\"},{\"internalType\":\"address\",\"name\":\"_dexRouterAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"poolToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"Redeemed\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_tokenSymbol\",\"type\":\"string\"},{\"internalType\":\"address[]\",\"name\":\"_path\",\"type\":\"address[]\"}],\"name\":\"addPath\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"addPoolToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"autoOffsetExactInETH\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountToSwap\",\"type\":\"uint256\"}],\"name\":\"autoOffsetExactInToken\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountToOffset\",\"type\":\"uint256\"}],\"name\":\"autoOffsetExactOutETH\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountToOffset\",\"type\":\"uint256\"}],\"name\":\"autoOffsetExactOutToken\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountToOffset\",\"type\":\"uint256\"}],\"name\":\"autoOffsetPoolToken\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"autoRedeem\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_tco2s\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_amounts\",\"type\":\"uint256[]\"}],\"name\":\"autoRetire\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fromTokenAmount\",\"type\":\"uint256\"}],\"name\":\"calculateExpectedPoolTokenForETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fromAmount\",\"type\":\"uint256\"}],\"name\":\"calculateExpectedPoolTokenForToken\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAmount\",\"type\":\"uint256\"}],\"name\":\"calculateNeededETHAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAmount\",\"type\":\"uint256\"}],\"name\":\"calculateNeededTokenAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"dexRouterAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"eligibleSwapPaths\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"eligibleSwapPathsBySymbol\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_erc20Address\",\"type\":\"address\"}],\"name\":\"isERC20AddressEligible\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_path\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"isPoolAddressEligible\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_isEligible\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"paths\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"poolAddresses\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_tokenSymbol\",\"type\":\"string\"}],\"name\":\"removePath\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"removePoolToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"}],\"name\":\"swapExactInETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fromAmount\",\"type\":\"uint256\"}],\"name\":\"swapExactInToken\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAmount\",\"type\":\"uint256\"}],\"name\":\"swapExactOutETH\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poolToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAmount\",\"type\":\"uint256\"}],\"name\":\"swapExactOutToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"tokenSymbolsForPaths\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"events\":{\"Redeemed(address,address,address[],uint256[])\":{\"params\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"poolToken\":\"The address of the pool token used in the redemption, e.g., NCT\",\"sender\":\"The sender of the transaction\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}}},\"kind\":\"dev\",\"methods\":{\"addPath(string,address[])\":{\"params\":{\"_path\":\"The path of the path to add\",\"_tokenSymbol\":\"The symbol of the token to add\"}},\"addPoolToken(address)\":{\"params\":{\"_poolToken\":\"The address of the pool token to add\"}},\"autoOffsetExactInETH(address)\":{\"details\":\"This function is only available on Polygon, not on Celo.\",\"params\":{\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoOffsetExactInToken(address,address,uint256)\":{\"details\":\"When automatically redeeming pool tokens for the oldest ones TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool token.\",\"params\":{\"_amountToSwap\":\"The amount of ERC20 token to swap into Toucan pool token. Full amount will be used for offsetting.\",\"_fromToken\":\"The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\",\"_poolToken\":\"The address of the pool token that the user wants to use, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoOffsetExactOutETH(address,uint256)\":{\"details\":\"If the user sends too much native tokens , the leftover amount will be sent back to the user. This function is only available on Polygon, not on Celo.\",\"params\":{\"_amountToOffset\":\"The amount of TCO2 to offset.\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoOffsetExactOutToken(address,address,uint256)\":{\"details\":\"When automatically redeeming pool tokens for the oldest ones TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool token.\",\"params\":{\"_amountToOffset\":\"The amount of TCO2 to offset\",\"_fromToken\":\"The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\",\"_poolToken\":\"The address of the pool token that the user wants to use, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoOffsetPoolToken(address,uint256)\":{\"params\":{\"_amountToOffset\":\"The amount of TCO2 to offset.\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoRedeem(address,uint256)\":{\"details\":\"Needs to be approved on the client side\",\"params\":{\"_amount\":\"Amount to redeem\",\"_fromToken\":\"Could be the address of NCT\"},\"returns\":{\"amounts\":\"An array of the amounts of each TCO2 that were redeemed\",\"tco2s\":\"An array of the TCO2 addresses that were redeemed\"}},\"autoRetire(address[],uint256[])\":{\"params\":{\"_amounts\":\"The amounts to retire from each of the corresponding TCO2 addresses\",\"_tco2s\":\"The addresses of the TCO2s to retire\"}},\"calculateExpectedPoolTokenForETH(address,uint256)\":{\"params\":{\"_fromTokenAmount\":\"The amount of native tokens to swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amountOut\":\"The expected amount of Pool token that can be acquired\"}},\"calculateExpectedPoolTokenForToken(address,address,uint256)\":{\"params\":{\"_fromAmount\":\"The amount of ERC20 token to swap\",\"_fromToken\":\"The address of the ERC20 token used for the swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amountOut\":\"The expected amount of Pool token that can be acquired\"}},\"calculateNeededETHAmount(address,uint256)\":{\"params\":{\"_poolToken\":\"The address of the pool token to swap for, for example, NCT\",\"_toAmount\":\"The desired amount of pool token to receive\"},\"returns\":{\"amountIn\":\"The amount of native tokens required in order to swap for the specified amount of the pool token\"}},\"calculateNeededTokenAmount(address,address,uint256)\":{\"params\":{\"_fromToken\":\"The address of the ERC20 token used for the swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\",\"_toAmount\":\"The desired amount of pool token to receive\"},\"returns\":{\"amountIn\":\"The amount of the ERC20 token required in order to swap for the specified amount of the pool token\"}},\"constructor\":{\"details\":\"See `isEligible()` for a list of tokens that can be used in the contract. These can be modified after deployment by the contract owner using `setEligibleTokenAddress()` and `deleteEligibleTokenAddress()`.\",\"params\":{\"_paths\":\"An array of arrays of addresses to describe the path needed to swap form the baseToken to the pool Token to the provided token symbols.\",\"_poolAddresses\":\"A list of pool token addresses.\",\"_tokenSymbolsForPaths\":\"An array of symbols of the token the user want to retire carbon credits for\"}},\"isERC20AddressEligible(address)\":{\"params\":{\"_erc20Address\":\"The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\"},\"returns\":{\"_path\":\"Returns the path of the token to be exchanged\"}},\"isPoolAddressEligible(address)\":{\"params\":{\"_poolToken\":\"The addresses of the pool token to redeem\"},\"returns\":{\"_isEligible\":\"Returns if token can be redeemed\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"removePath(string)\":{\"params\":{\"_tokenSymbol\":\"The symbol of the path to remove\"}},\"removePoolToken(address)\":{\"params\":{\"_poolToken\":\"The address of the pool token to remove\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"swapExactInETH(address)\":{\"params\":{\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\"},\"returns\":{\"amountOut\":\"Resulting amount of pool token that got acquired for the swapped native tokens .\"}},\"swapExactInToken(address,address,uint256)\":{\"details\":\"Needs to be approved on the client side.\",\"params\":{\"_fromAmount\":\"The amount of ERC20 token to swap e.g., NCT\",\"_fromToken\":\"The address of the ERC20 token used for the swap\",\"_poolToken\":\"The address of the pool token to swap for,\"},\"returns\":{\"amountOut\":\"Resulting amount of pool token that got acquired for the swapped ERC20 tokens.\"}},\"swapExactOutETH(address,uint256)\":{\"params\":{\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\",\"_toAmount\":\"The required amount of the pool token (NCT/BCT)\"}},\"swapExactOutToken(address,address,uint256)\":{\"details\":\"Needs to be approved on the client side\",\"params\":{\"_fromToken\":\"The address of the ERC20 token used for the swap\",\"_poolToken\":\"The address of the pool token to swap for, e.g., NCT\",\"_toAmount\":\"The required amount of the pool token (NCT/BCT)\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"title\":\"Toucan Protocol Offset Helpers\",\"version\":1},\"userdoc\":{\"events\":{\"Redeemed(address,address,address[],uint256[])\":{\"notice\":\"Emitted upon successful redemption of TCO2 tokens from a Toucan pool token e.g., NCT.\"}},\"kind\":\"user\",\"methods\":{\"addPath(string,address[])\":{\"notice\":\"Change or add eligible paths and their addresses.\"},\"addPoolToken(address)\":{\"notice\":\"Change or add pool token addresses.\"},\"autoOffsetExactInETH(address)\":{\"notice\":\"Retire carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC. All provided native tokens is consumed for offsetting. Use `calculateExpectedPoolTokenForETH()` to calculate the expected amount of Pool token that can be acquired by swapping the provided amount of native tokens e.g., MATIC. This function: 1. Swaps the Matic sent to the contract for the specified pool token. 2. Redeems the pool token for the oldest TCO2 tokens available. 3. Retires the TCO2 tokens.\"},\"autoOffsetExactInToken(address,address,uint256)\":{\"notice\":\"Retire carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending ERC20 tokens (cUSD, USDC, WETH, WMATIC). All provided token is consumed for offsetting. Use `calculateExpectedPoolTokenForToken()` to calculate the expected amount of Pool token that can be acquired by swapping the provided amount of ERC20 token. This function: 1. Swaps the ERC20 token sent to the contract for the specified pool token. 2. Redeems the pool token for the oldest TCO2 tokens available. 3. Retires the TCO2 tokens. Note: The client must approve the ERC20 token that is sent to the contract.\"},\"autoOffsetExactOutETH(address,uint256)\":{\"notice\":\"Retire carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC. Use `calculateNeededETHAmount()` first in order to find out how much native tokens are required to retire the specified quantity of TCO2. This function: 1. Swaps the Matic sent to the contract for the specified pool token. 2. Redeems the pool token for the oldest TCO2 tokens available. 3. Retires the TCO2 tokens.\"},\"autoOffsetExactOutToken(address,address,uint256)\":{\"notice\":\"Retire carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending ERC20 tokens (cUSD, USDC, WETH, WMATIC). Use `calculateNeededTokenAmount` first in order to find out how much of the ERC20 token is required to retire the specified quantity of TCO2. This function: 1. Swaps the ERC20 token sent to the contract for the specified pool token. 2. Redeems the pool token for the oldest TCO2 tokens available. 3. Retires the TCO2 tokens. Note: The client must approve the ERC20 token that is sent to the contract.\"},\"autoOffsetPoolToken(address,uint256)\":{\"notice\":\"Retire carbon credits using the oldest TCO2 tokens available by sending pool tokens, e.g., NCT. This function: 1. Redeems the pool token for the oldest TCO2 tokens available. 2. Retires the TCO2 tokens. Note: The client must approve the pool token that is sent.\"},\"autoRedeem(address,uint256)\":{\"notice\":\"Redeems the specified amount of NCT / BCT for TCO2.\"},\"autoRetire(address[],uint256[])\":{\"notice\":\"Retire the specified TCO2 tokens.\"},\"calculateExpectedPoolTokenForETH(address,uint256)\":{\"notice\":\"Calculates the expected amount of pool token that can be acquired by swapping the provided amount of native tokens e.g., MATIC.\"},\"calculateExpectedPoolTokenForToken(address,address,uint256)\":{\"notice\":\"Calculates the expected amount of pool token that can be acquired by swapping the provided amount of ERC20 token.\"},\"calculateNeededETHAmount(address,uint256)\":{\"notice\":\"Return how much native tokens e.g, MATIC is required in order to swap for the desired amount of a pool token, e.g., NCT.\"},\"calculateNeededTokenAmount(address,address,uint256)\":{\"notice\":\"Return how much of the specified ERC20 token is required in order to swap for the desired amount of a pool token, for example, e.g., NCT.\"},\"constructor\":{\"notice\":\"Contract constructor. Should specify arrays of ERC20 symbols and addresses that can used by the contract.\"},\"isERC20AddressEligible(address)\":{\"notice\":\"Checks if ERC20 Token is eligible for Offsetting.\"},\"isPoolAddressEligible(address)\":{\"notice\":\"Cheks if Pool Token is eligible for Offsetting.\"},\"removePath(string)\":{\"notice\":\"Delete eligible tokens stored in the contract.\"},\"removePoolToken(address)\":{\"notice\":\"Delete eligible pool token addresses stored in the contract.\"},\"swapExactInETH(address)\":{\"notice\":\"Swap native tokens e.g., MATIC for pool tokens (BCT/NCT) on SushiSwap. All provided native tokens will be swapped.\"},\"swapExactInToken(address,address,uint256)\":{\"notice\":\"Swap eligible ERC20 tokens for pool tokens (BCT/NCT) on SushiSwap. All provided ERC20 tokens will be swapped.\"},\"swapExactOutETH(address,uint256)\":{\"notice\":\"Swap native tokens e.g., MATIC for pool tokens (BCT/NCT) on SushiSwap. Remaining native tokens that was not consumed by the swap is returned.\"},\"swapExactOutToken(address,address,uint256)\":{\"notice\":\"Swap eligible ERC20 tokens for pool tokens (BCT/NCT) on SushiSwap\"}},\"notice\":\"Helper functions that simplify the carbon offsetting (retirement) process. Retiring carbon tokens requires multiple steps and interactions with Toucan Protocol's main contracts: 1. Obtain a pool token e.g., NCT (by performing a token swap on a DEX). 2. Redeem the pool token for a TCO2 token. 3. Retire the TCO2 token. These steps are combined in each of the following \\\"auto offset\\\" methods implemented in `OffsetHelper` to allow a retirement within one transaction: - `autoOffsetPoolToken()` if the user already owns a Toucan pool token e.g., NCT, - `autoOffsetExactOutETH()` if the user would like to perform a retirement using native tokens e.g., MATIC, specifying the exact amount of TCO2s to retire (only on Polygon, not on Celo), - `autoOffsetExactInETH()` if the user would like to perform a retirement using native tokens, swapping all sent native tokens into TCO2s (only on Polygon, not on Celo), - `autoOffsetExactOutToken()` if the user would like to perform a retirement using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount of TCO2s to retire, - `autoOffsetExactInToken()` if the user would like to perform a retirement using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount of token to swap into TCO2s. In these methods, \\\"auto\\\" refers to the fact that these methods use `autoRedeem()` in order to automatically choose a TCO2 token corresponding to the oldest tokenized carbon project in the specfified token pool. There are no fees incurred by the user when using `autoRedeem()`, i.e., the user receives 1 TCO2 token for each pool token (BCT/NCT) redeemed. There are two `view` helper functions `calculateNeededETHAmount()` and `calculateNeededTokenAmount()` that should be called before using `autoOffsetExactOutETH()` and `autoOffsetExactOutToken()`, to determine how much native tokens e.g., MATIC, respectively how much of the ERC20 token must be sent to the `OffsetHelper` contract in order to retire the specified amount of carbon. The two `view` helper functions `calculateExpectedPoolTokenForETH()` and `calculateExpectedPoolTokenForToken()` can be used to calculate the expected amount of TCO2s that will be offset using functions `autoOffsetExactInETH()` and `autoOffsetExactInToken()`.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/OffsetHelper.sol\":\"OffsetHelper\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20Upgradeable {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x4e733d3164f73f461eaf9d8087a7ad1ea180bdc8ba0d3d61b0e1ae16d8e63dff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n function safePermit(\\n IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9b72f93be69ca894d8492c244259615c4a742afc8d63720dbc8bb81087d9b238\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721Receiver {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol\":{\"content\":\"pragma solidity >=0.6.2;\\n\\ninterface IUniswapV2Router01 {\\n function factory() external pure returns (address);\\n function WETH() external pure returns (address);\\n\\n function addLiquidity(\\n address tokenA,\\n address tokenB,\\n uint amountADesired,\\n uint amountBDesired,\\n uint amountAMin,\\n uint amountBMin,\\n address to,\\n uint deadline\\n ) external returns (uint amountA, uint amountB, uint liquidity);\\n function addLiquidityETH(\\n address token,\\n uint amountTokenDesired,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline\\n ) external payable returns (uint amountToken, uint amountETH, uint liquidity);\\n function removeLiquidity(\\n address tokenA,\\n address tokenB,\\n uint liquidity,\\n uint amountAMin,\\n uint amountBMin,\\n address to,\\n uint deadline\\n ) external returns (uint amountA, uint amountB);\\n function removeLiquidityETH(\\n address token,\\n uint liquidity,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline\\n ) external returns (uint amountToken, uint amountETH);\\n function removeLiquidityWithPermit(\\n address tokenA,\\n address tokenB,\\n uint liquidity,\\n uint amountAMin,\\n uint amountBMin,\\n address to,\\n uint deadline,\\n bool approveMax, uint8 v, bytes32 r, bytes32 s\\n ) external returns (uint amountA, uint amountB);\\n function removeLiquidityETHWithPermit(\\n address token,\\n uint liquidity,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline,\\n bool approveMax, uint8 v, bytes32 r, bytes32 s\\n ) external returns (uint amountToken, uint amountETH);\\n function swapExactTokensForTokens(\\n uint amountIn,\\n uint amountOutMin,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external returns (uint[] memory amounts);\\n function swapTokensForExactTokens(\\n uint amountOut,\\n uint amountInMax,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external returns (uint[] memory amounts);\\n function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)\\n external\\n payable\\n returns (uint[] memory amounts);\\n function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)\\n external\\n returns (uint[] memory amounts);\\n function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)\\n external\\n returns (uint[] memory amounts);\\n function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)\\n external\\n payable\\n returns (uint[] memory amounts);\\n\\n function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);\\n function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);\\n function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);\\n function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);\\n function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);\\n}\\n\",\"keccak256\":\"0x8a3c5c449d4b7cd76513ed6995f4b86e4a86f222c770f8442f5fc128ce29b4d2\"},\"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\":{\"content\":\"pragma solidity >=0.6.2;\\n\\nimport './IUniswapV2Router01.sol';\\n\\ninterface IUniswapV2Router02 is IUniswapV2Router01 {\\n function removeLiquidityETHSupportingFeeOnTransferTokens(\\n address token,\\n uint liquidity,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline\\n ) external returns (uint amountETH);\\n function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(\\n address token,\\n uint liquidity,\\n uint amountTokenMin,\\n uint amountETHMin,\\n address to,\\n uint deadline,\\n bool approveMax, uint8 v, bytes32 r, bytes32 s\\n ) external returns (uint amountETH);\\n\\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\\n uint amountIn,\\n uint amountOutMin,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external;\\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\\n uint amountOutMin,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external payable;\\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\\n uint amountIn,\\n uint amountOutMin,\\n address[] calldata path,\\n address to,\\n uint deadline\\n ) external;\\n}\\n\",\"keccak256\":\"0x744e30c133bd0f7ca9e7163433cf6d72f45c6bb1508c2c9c02f1a6db796ae59d\"},\"contracts/OffsetHelper.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2022 Toucan Labs\\n// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\\\";\\nimport \\\"./OffsetHelperStorage.sol\\\";\\nimport \\\"./interfaces/IToucanPoolToken.sol\\\";\\nimport \\\"./interfaces/IToucanCarbonOffsets.sol\\\";\\nimport \\\"./interfaces/IToucanContractRegistry.sol\\\";\\n\\n/**\\n * @title Toucan Protocol Offset Helpers\\n * @notice Helper functions that simplify the carbon offsetting (retirement)\\n * process.\\n *\\n * Retiring carbon tokens requires multiple steps and interactions with\\n * Toucan Protocol's main contracts:\\n * 1. Obtain a pool token e.g., NCT (by performing a token\\n * swap on a DEX).\\n * 2. Redeem the pool token for a TCO2 token.\\n * 3. Retire the TCO2 token.\\n *\\n * These steps are combined in each of the following \\\"auto offset\\\" methods\\n * implemented in `OffsetHelper` to allow a retirement within one transaction:\\n * - `autoOffsetPoolToken()` if the user already owns a Toucan pool\\n * token e.g., NCT,\\n * - `autoOffsetExactOutETH()` if the user would like to perform a retirement\\n * using native tokens e.g., MATIC, specifying the exact amount of TCO2s to retire (only on Polygon, not on Celo),\\n * - `autoOffsetExactInETH()` if the user would like to perform a retirement\\n * using native tokens, swapping all sent native tokens into TCO2s (only on Polygon, not on Celo),\\n * - `autoOffsetExactOutToken()` if the user would like to perform a retirement\\n * using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount\\n * of TCO2s to retire,\\n * - `autoOffsetExactInToken()` if the user would like to perform a retirement\\n * using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount\\n * of token to swap into TCO2s.\\n *\\n * In these methods, \\\"auto\\\" refers to the fact that these methods use\\n * `autoRedeem()` in order to automatically choose a TCO2 token corresponding\\n * to the oldest tokenized carbon project in the specfified token pool.\\n * There are no fees incurred by the user when using `autoRedeem()`, i.e., the\\n * user receives 1 TCO2 token for each pool token (BCT/NCT) redeemed.\\n *\\n * There are two `view` helper functions `calculateNeededETHAmount()` and\\n * `calculateNeededTokenAmount()` that should be called before using\\n * `autoOffsetExactOutETH()` and `autoOffsetExactOutToken()`, to determine how\\n * much native tokens e.g., MATIC, respectively how much of the ERC20 token must be sent to the\\n * `OffsetHelper` contract in order to retire the specified amount of carbon.\\n *\\n * The two `view` helper functions `calculateExpectedPoolTokenForETH()` and\\n * `calculateExpectedPoolTokenForToken()` can be used to calculate the\\n * expected amount of TCO2s that will be offset using functions\\n * `autoOffsetExactInETH()` and `autoOffsetExactInToken()`.\\n */\\ncontract OffsetHelper is OffsetHelperStorage {\\n using SafeERC20 for IERC20;\\n // As Celo allows to pay the gas fees with other tokens than the native token,\\n // it's not possible ot use the swapETH (swap native tokens) functions.\\n uint256 private constant CELO_MAINNET_CHAINID = 42220;\\n uint256 private constant ALFAJORES_MAINNET_CHAINID = 44787;\\n\\n /**\\n * @notice Emitted upon successful redemption of TCO2 tokens from a Toucan\\n * pool token e.g., NCT.\\n *\\n * @param sender The sender of the transaction\\n * @param poolToken The address of the pool token used in the\\n * redemption, e.g., NCT\\n * @param tco2s An array of the TCO2 addresses that were redeemed\\n * @param amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n event Redeemed(\\n address sender,\\n address poolToken,\\n address[] tco2s,\\n uint256[] amounts\\n );\\n\\n modifier onlyRedeemable(address _token) {\\n require(isRedeemable(_token), \\\"Token not redeemable.\\\");\\n\\n _;\\n }\\n\\n modifier onlySwappable(address _token) {\\n require(isSwappable(_token), \\\"Path doesn't yet exist.\\\");\\n\\n _;\\n }\\n\\n modifier isNotCelo() {\\n require(\\n block.chainid != CELO_MAINNET_CHAINID &&\\n block.chainid != ALFAJORES_MAINNET_CHAINID,\\n \\\"The function is not available on Celo.\\\"\\n );\\n\\n _;\\n }\\n\\n /**\\n * @notice Contract constructor. Should specify arrays of ERC20 symbols and\\n * addresses that can used by the contract.\\n *\\n * @dev See `isEligible()` for a list of tokens that can be used in the\\n * contract. These can be modified after deployment by the contract owner\\n * using `setEligibleTokenAddress()` and `deleteEligibleTokenAddress()`.\\n *\\n * @param _poolAddresses A list of pool token addresses.\\n * @param _tokenSymbolsForPaths An array of symbols of the token the user want to retire carbon credits for\\n * @param _paths An array of arrays of addresses to describe the path needed to swap form the baseToken to the pool Token\\n * to the provided token symbols.\\n */\\n constructor(\\n address[] memory _poolAddresses,\\n string[] memory _tokenSymbolsForPaths,\\n address[][] memory _paths,\\n address _dexRouterAddress\\n ) {\\n poolAddresses = _poolAddresses;\\n tokenSymbolsForPaths = _tokenSymbolsForPaths;\\n paths = _paths;\\n dexRouterAddress = _dexRouterAddress;\\n\\n uint256 eligibleSwapPathsBySymbolLen = _tokenSymbolsForPaths.length;\\n for (uint256 i; i < eligibleSwapPathsBySymbolLen; i++) {\\n eligibleSwapPaths[_paths[i][0]] = _paths[i];\\n eligibleSwapPathsBySymbol[_tokenSymbolsForPaths[i]] = _paths[i];\\n }\\n }\\n\\n // The receive and fallback method are needed to fix the situation where transfering dust native tokens\\n // in the native tokens to token swap fails\\n receive() external payable {}\\n\\n // ----------------------------------------\\n // Public functions\\n // ----------------------------------------\\n\\n /**\\n * @notice Retire carbon credits using the oldest TCO2\\n * tokens available from the specified Toucan token pool by sending ERC20\\n * tokens (cUSD, USDC, WETH, WMATIC). Use `calculateNeededTokenAmount` first in\\n * order to find out how much of the ERC20 token is required to retire the\\n * specified quantity of TCO2.\\n *\\n * This function:\\n * 1. Swaps the ERC20 token sent to the contract for the specified pool token.\\n * 2. Redeems the pool token for the oldest TCO2 tokens available.\\n * 3. Retires the TCO2 tokens.\\n *\\n * Note: The client must approve the ERC20 token that is sent to the contract.\\n *\\n * @dev When automatically redeeming pool tokens for the oldest ones\\n * TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool\\n * token.\\n *\\n * @param _fromToken The address of the ERC20 token that the user sends\\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\\n * @param _poolToken The address of the pool token that the\\n * user wants to use, e.g., NCT\\n * @param _amountToOffset The amount of TCO2 to offset\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetExactOutToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _amountToOffset\\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\\n // swap input token for BCT / NCT\\n swapExactOutToken(_fromToken, _poolToken, _amountToOffset);\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire carbon credits using the oldest TCO2\\n * tokens available from the specified Toucan token pool by sending ERC20\\n * tokens (cUSD, USDC, WETH, WMATIC). All provided token is consumed for\\n * offsetting. Use `calculateExpectedPoolTokenForToken()` to calculate the expected amount\\n * of Pool token that can be acquired by swapping the provided amount of ERC20 token.\\n *\\n * This function:\\n * 1. Swaps the ERC20 token sent to the contract for the specified pool token.\\n * 2. Redeems the pool token for the oldest TCO2 tokens available.\\n * 3. Retires the TCO2 tokens.\\n *\\n * Note: The client must approve the ERC20 token that is sent to the contract.\\n *\\n * @dev When automatically redeeming pool tokens for the oldest ones\\n * TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool\\n * token.\\n *\\n * @param _fromToken The address of the ERC20 token that the user sends\\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\\n * @param _poolToken The address of the pool token that the\\n * user wants to use, e.g., NCT\\n * @param _amountToSwap The amount of ERC20 token to swap into Toucan pool\\n * token. Full amount will be used for offsetting.\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetExactInToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _amountToSwap\\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\\n // swap input token for BCT / NCT\\n uint256 amountToOffset = swapExactInToken(\\n _fromToken,\\n _poolToken,\\n _amountToSwap\\n );\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire carbon credits using the oldest TCO2\\n * tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC.\\n * Use `calculateNeededETHAmount()` first in order to find out how much\\n * native tokens are required to retire the specified quantity of TCO2.\\n *\\n * This function:\\n * 1. Swaps the Matic sent to the contract for the specified pool token.\\n * 2. Redeems the pool token for the oldest TCO2 tokens available.\\n * 3. Retires the TCO2 tokens.\\n *\\n * @dev If the user sends too much native tokens , the leftover amount will be sent back\\n * to the user. This function is only available on Polygon, not on Celo.\\n *\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _amountToOffset The amount of TCO2 to offset.\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetExactOutETH(\\n address _poolToken,\\n uint256 _amountToOffset\\n )\\n public\\n payable\\n isNotCelo\\n returns (address[] memory tco2s, uint256[] memory amounts)\\n {\\n // swap native tokens for BCT / NCT\\n swapExactOutETH(_poolToken, _amountToOffset);\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire carbon credits using the oldest TCO2\\n * tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC.\\n * All provided native tokens is consumed for offsetting.\\n * Use `calculateExpectedPoolTokenForETH()` to calculate the expected amount of\\n * Pool token that can be acquired by swapping the provided amount of native tokens e.g., MATIC.\\n *\\n * This function:\\n * 1. Swaps the Matic sent to the contract for the specified pool token.\\n * 2. Redeems the pool token for the oldest TCO2 tokens available.\\n * 3. Retires the TCO2 tokens.\\n *\\n * @dev This function is only available on Polygon, not on Celo.\\n *\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetExactInETH(\\n address _poolToken\\n )\\n public\\n payable\\n isNotCelo\\n returns (address[] memory tco2s, uint256[] memory amounts)\\n {\\n // swap native tokens for BCT / NCT\\n uint256 amountToOffset = swapExactInETH(_poolToken);\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire carbon credits using the oldest TCO2\\n * tokens available by sending pool tokens, e.g., NCT.\\n *\\n * This function:\\n * 1. Redeems the pool token for the oldest TCO2 tokens available.\\n * 2. Retires the TCO2 tokens.\\n *\\n * Note: The client must approve the pool token that is sent.\\n *\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _amountToOffset The amount of TCO2 to offset.\\n *\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoOffsetPoolToken(\\n address _poolToken,\\n uint256 _amountToOffset\\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\\n // deposit pool token from user to this contract\\n IERC20(_poolToken).safeTransferFrom(\\n msg.sender,\\n address(this),\\n _amountToOffset\\n );\\n\\n // redeem BCT / NCT for TCO2s\\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\\n\\n // retire the TCO2s to achieve offset\\n autoRetire(tco2s, amounts);\\n }\\n\\n /**\\n * @notice Redeems the specified amount of NCT / BCT for TCO2.\\n * @dev Needs to be approved on the client side\\n * @param _fromToken Could be the address of NCT\\n * @param _amount Amount to redeem\\n * @return tco2s An array of the TCO2 addresses that were redeemed\\n * @return amounts An array of the amounts of each TCO2 that were redeemed\\n */\\n function autoRedeem(\\n address _fromToken,\\n uint256 _amount\\n )\\n public\\n onlyRedeemable(_fromToken)\\n returns (address[] memory tco2s, uint256[] memory amounts)\\n {\\n require(\\n IERC20(_fromToken).balanceOf(address(this)) >= _amount,\\n \\\"Insufficient NCT/BCT balance\\\"\\n );\\n\\n // instantiate pool token (NCT)\\n IToucanPoolToken PoolTokenImplementation = IToucanPoolToken(_fromToken);\\n\\n // auto redeem pool token for TCO2; will transfer automatically picked TCO2 to this contract\\n (tco2s, amounts) = PoolTokenImplementation.redeemAuto2(_amount);\\n\\n emit Redeemed(msg.sender, _fromToken, tco2s, amounts);\\n }\\n\\n /**\\n * @notice Retire the specified TCO2 tokens.\\n * @param _tco2s The addresses of the TCO2s to retire\\n * @param _amounts The amounts to retire from each of the corresponding\\n * TCO2 addresses\\n */\\n function autoRetire(\\n address[] memory _tco2s,\\n uint256[] memory _amounts\\n ) public {\\n uint256 tco2sLen = _tco2s.length;\\n require(tco2sLen != 0, \\\"Array empty\\\");\\n\\n require(tco2sLen == _amounts.length, \\\"Arrays unequal\\\");\\n\\n for (uint i = 0; i < tco2sLen; i++) {\\n if (_amounts[i] == 0) {\\n continue;\\n }\\n require(\\n IERC20(_tco2s[i]).balanceOf(address(this)) >= _amounts[i],\\n \\\"Insufficient TCO2 balance\\\"\\n );\\n\\n IToucanCarbonOffsets(_tco2s[i]).retire(_amounts[i]);\\n }\\n }\\n\\n /**\\n * @notice Swap eligible ERC20 tokens for pool tokens (BCT/NCT) on SushiSwap\\n * @dev Needs to be approved on the client side\\n * @param _fromToken The address of the ERC20 token used for the swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _toAmount The required amount of the pool token (NCT/BCT)\\n */\\n function swapExactOutToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _toAmount\\n ) public onlySwappable(_fromToken) onlyRedeemable(_poolToken) {\\n // calculate path & amounts\\n (\\n address[] memory path,\\n uint256[] memory expAmounts\\n ) = calculateExactOutSwap(_fromToken, _poolToken, _toAmount);\\n uint256 amountIn = expAmounts[0];\\n\\n // transfer tokens\\n IERC20(_fromToken).safeTransferFrom(\\n msg.sender,\\n address(this),\\n amountIn\\n );\\n\\n // approve router\\n IERC20(_fromToken).approve(dexRouterAddress, amountIn);\\n\\n // swap\\n uint256[] memory amounts = dexRouter().swapTokensForExactTokens(\\n _toAmount,\\n amountIn, // max. input amount\\n path,\\n address(this),\\n block.timestamp\\n );\\n\\n // remove remaining approval if less input token was consumed\\n if (amounts[0] < amountIn) {\\n IERC20(_fromToken).approve(dexRouterAddress, 0);\\n }\\n }\\n\\n /**\\n * @notice Swap eligible ERC20 tokens for pool tokens (BCT/NCT) on\\n * SushiSwap. All provided ERC20 tokens will be swapped.\\n * @dev Needs to be approved on the client side.\\n * @param _fromToken The address of the ERC20 token used for the swap\\n * @param _poolToken The address of the pool token to swap for,\\n * @param _fromAmount The amount of ERC20 token to swap\\n * e.g., NCT\\n * @return amountOut Resulting amount of pool token that got acquired for the\\n * swapped ERC20 tokens.\\n */\\n function swapExactInToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _fromAmount\\n )\\n public\\n onlySwappable(_fromToken)\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountOut)\\n {\\n // calculate path & amounts\\n address[] memory path = generatePath(_fromToken, _poolToken);\\n\\n uint256 len = path.length;\\n\\n // transfer tokens\\n IERC20(_fromToken).safeTransferFrom(\\n msg.sender,\\n address(this),\\n _fromAmount\\n );\\n\\n // approve router\\n IERC20(_fromToken).safeApprove(dexRouterAddress, _fromAmount);\\n\\n // swap\\n uint256[] memory amounts = dexRouter().swapExactTokensForTokens(\\n _fromAmount,\\n 0, // min. output amount\\n path,\\n address(this),\\n block.timestamp\\n );\\n amountOut = amounts[len - 1];\\n }\\n\\n /**\\n * @notice Swap native tokens e.g., MATIC for pool tokens (BCT/NCT) on SushiSwap.\\n * Remaining native tokens that was not consumed by the swap is returned.\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _toAmount The required amount of the pool token (NCT/BCT)\\n */\\n function swapExactOutETH(\\n address _poolToken,\\n uint256 _toAmount\\n ) public payable isNotCelo onlyRedeemable(_poolToken) {\\n // create path & amounts\\n // wrap the native token\\n address fromToken = eligibleSwapPathsBySymbol[\\\"WMATIC\\\"][0];\\n address[] memory path = generatePath(fromToken, _poolToken);\\n\\n // swap\\n uint256[] memory amounts = dexRouter().swapETHForExactTokens{\\n value: msg.value\\n }(_toAmount, path, address(this), block.timestamp);\\n\\n // send surplus back\\n if (msg.value > amounts[0]) {\\n uint256 leftoverETH = msg.value - amounts[0];\\n (bool success, ) = msg.sender.call{value: leftoverETH}(\\n new bytes(0)\\n );\\n\\n require(success, \\\"Failed to send surplus back\\\");\\n }\\n }\\n\\n /**\\n * @notice Swap native tokens e.g., MATIC for pool tokens (BCT/NCT) on SushiSwap. All\\n * provided native tokens will be swapped.\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @return amountOut Resulting amount of pool token that got acquired for the\\n * swapped native tokens .\\n */\\n function swapExactInETH(\\n address _poolToken\\n )\\n public\\n payable\\n isNotCelo\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountOut)\\n {\\n // create path & amounts\\n uint256 fromAmount = msg.value;\\n // wrap the native token\\n address fromToken = eligibleSwapPathsBySymbol[\\\"WMATIC\\\"][0];\\n address[] memory path = generatePath(fromToken, _poolToken);\\n\\n uint256 len = path.length;\\n\\n // swap\\n uint256[] memory amounts = dexRouter().swapExactETHForTokens{\\n value: fromAmount\\n }(0, path, address(this), block.timestamp);\\n amountOut = amounts[len - 1];\\n }\\n\\n // ----------------------------------------\\n // Public view functions\\n // ----------------------------------------\\n\\n /**\\n * @notice Return how much of the specified ERC20 token is required in\\n * order to swap for the desired amount of a pool token, for\\n * example, e.g., NCT.\\n *\\n * @param _fromToken The address of the ERC20 token used for the swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _toAmount The desired amount of pool token to receive\\n * @return amountIn The amount of the ERC20 token required in order to\\n * swap for the specified amount of the pool token\\n */\\n function calculateNeededTokenAmount(\\n address _fromToken,\\n address _poolToken,\\n uint256 _toAmount\\n )\\n public\\n view\\n onlySwappable(_fromToken)\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountIn)\\n {\\n (, uint256[] memory amounts) = calculateExactOutSwap(\\n _fromToken,\\n _poolToken,\\n _toAmount\\n );\\n amountIn = amounts[0];\\n }\\n\\n /**\\n * @notice Return how much native tokens e.g, MATIC is required in order to swap for the\\n * desired amount of a pool token, e.g., NCT.\\n * @param _poolToken The address of the pool token to swap for, for\\n * example, NCT\\n * @param _toAmount The desired amount of pool token to receive\\n * @return amountIn The amount of native tokens required in order to swap for\\n * the specified amount of the pool token\\n */\\n function calculateNeededETHAmount(\\n address _poolToken,\\n uint256 _toAmount\\n ) public view onlyRedeemable(_poolToken) returns (uint256 amountIn) {\\n address fromToken = eligibleSwapPathsBySymbol[\\\"WMATIC\\\"][0];\\n (, uint256[] memory amounts) = calculateExactOutSwap(\\n fromToken,\\n _poolToken,\\n _toAmount\\n );\\n amountIn = amounts[0];\\n }\\n\\n /**\\n * @notice Calculates the expected amount of pool token that can be\\n * acquired by swapping the provided amount of ERC20 token.\\n *\\n * @param _fromToken The address of the ERC20 token used for the swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @param _fromAmount The amount of ERC20 token to swap\\n * @return amountOut The expected amount of Pool token that can be acquired\\n */\\n function calculateExpectedPoolTokenForToken(\\n address _fromToken,\\n address _poolToken,\\n uint256 _fromAmount\\n )\\n public\\n view\\n onlySwappable(_fromToken)\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountOut)\\n {\\n (, uint256[] memory amounts) = calculateExactInSwap(\\n _fromToken,\\n _poolToken,\\n _fromAmount\\n );\\n amountOut = amounts[amounts.length - 1];\\n }\\n\\n /**\\n * @notice Calculates the expected amount of pool token that can be\\n * acquired by swapping the provided amount of native tokens e.g., MATIC.\\n *\\n * @param _fromTokenAmount The amount of native tokens to swap\\n * @param _poolToken The address of the pool token to swap for,\\n * e.g., NCT\\n * @return amountOut The expected amount of Pool token that can be acquired\\n */\\n function calculateExpectedPoolTokenForETH(\\n address _poolToken,\\n uint256 _fromTokenAmount\\n )\\n public\\n view\\n isNotCelo\\n onlyRedeemable(_poolToken)\\n returns (uint256 amountOut)\\n {\\n address fromToken = eligibleSwapPathsBySymbol[\\\"WMATIC\\\"][0];\\n (, uint256[] memory amounts) = calculateExactInSwap(\\n fromToken,\\n _poolToken,\\n _fromTokenAmount\\n );\\n amountOut = amounts[amounts.length - 1];\\n }\\n\\n // ----------------------------------------\\n // Internal functions\\n // ----------------------------------------\\n\\n function calculateExactOutSwap(\\n address _fromToken,\\n address _poolToken,\\n uint256 _toAmount\\n ) internal view returns (address[] memory path, uint256[] memory amounts) {\\n // create path & calculate amounts\\n path = generatePath(_fromToken, _poolToken);\\n uint256 len = path.length;\\n\\n amounts = dexRouter().getAmountsIn(_toAmount, path);\\n\\n // sanity check arrays\\n require(len == amounts.length, \\\"Arrays unequal\\\");\\n require(_toAmount == amounts[len - 1], \\\"Output amount mismatch\\\");\\n }\\n\\n function calculateExactInSwap(\\n address _fromToken,\\n address _poolToken,\\n uint256 _fromAmount\\n ) internal view returns (address[] memory path, uint256[] memory amounts) {\\n // create path & calculate amounts\\n path = generatePath(_fromToken, _poolToken);\\n uint256 len = path.length;\\n\\n amounts = dexRouter().getAmountsOut(_fromAmount, path);\\n\\n // sanity check arrays\\n require(len == amounts.length, \\\"Arrays unequal\\\");\\n require(_fromAmount == amounts[0], \\\"Input amount mismatch\\\");\\n }\\n\\n /**\\n * @notice Show all pool token addresses that can be used to retired.\\n * @param _fromToken a list of token symbols that can be retired.\\n * @param _toToken a list of token symbols that can be retired.\\n */\\n function generatePath(\\n address _fromToken,\\n address _toToken\\n ) internal view returns (address[] memory path) {\\n uint256 len = eligibleSwapPaths[_fromToken].length;\\n if (len == 1) {\\n path = new address[](2);\\n path[0] = _fromToken;\\n path[1] = _toToken;\\n return path;\\n }\\n if (len == 2) {\\n path = new address[](3);\\n path[0] = _fromToken;\\n path[1] = eligibleSwapPaths[_fromToken][1];\\n path[2] = _toToken;\\n return path;\\n }\\n if (len == 3) {\\n path = new address[](3);\\n path[0] = _fromToken;\\n path[1] = eligibleSwapPaths[_fromToken][1];\\n path[2] = eligibleSwapPaths[_fromToken][2];\\n path[3] = _toToken;\\n return path;\\n } else {\\n path = new address[](4);\\n path[0] = _fromToken;\\n path[1] = eligibleSwapPaths[_fromToken][1];\\n path[2] = eligibleSwapPaths[_fromToken][2];\\n path[3] = eligibleSwapPaths[_fromToken][3];\\n path[4] = _toToken;\\n return path;\\n }\\n }\\n\\n function dexRouter() internal view returns (IUniswapV2Router02) {\\n return IUniswapV2Router02(dexRouterAddress);\\n }\\n\\n // ----------------------------------------\\n // Private functions\\n // ----------------------------------------\\n\\n /**\\n * @notice Checks whether an address is a pool token address\\n * @param _erc20Address address of token to be checked\\n * @return True if the address is a pool token address\\n */\\n function isRedeemable(address _erc20Address) private view returns (bool) {\\n for (uint i = 0; i < poolAddresses.length; i++) {\\n if (poolAddresses[i] == _erc20Address) {\\n return true;\\n }\\n }\\n\\n return false;\\n }\\n\\n /**\\n * @notice Checks whether an address can be used in a token swap\\n * @param _erc20Address address of token to be checked\\n * @return True if the specified address can be used in a swap\\n */\\n function isSwappable(address _erc20Address) private view returns (bool) {\\n for (uint i = 0; i < paths.length; i++) {\\n if (paths[i][0] == _erc20Address) {\\n return true;\\n }\\n }\\n\\n return false;\\n }\\n\\n // ----------------------------------------\\n // Admin methods\\n // ----------------------------------------\\n\\n /**\\n * @notice Checks if ERC20 Token is eligible for Offsetting.\\n * @param _erc20Address The address of the ERC20 token that the user sends\\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\\n * @return _path Returns the path of the token to be exchanged\\n */\\n\\n function isERC20AddressEligible(\\n address _erc20Address\\n ) public view returns (address[] memory _path) {\\n _path = eligibleSwapPaths[_erc20Address];\\n }\\n\\n /**\\n * @notice Change or add eligible paths and their addresses.\\n * @param _tokenSymbol The symbol of the token to add\\n * @param _path The path of the path to add\\n */\\n function addPath(\\n string memory _tokenSymbol,\\n address[] memory _path\\n ) public virtual onlyOwner {\\n eligibleSwapPaths[_path[0]] = _path;\\n eligibleSwapPathsBySymbol[_tokenSymbol] = _path;\\n tokenSymbolsForPaths.push(_tokenSymbol);\\n }\\n\\n /**\\n * @notice Delete eligible tokens stored in the contract.\\n * @param _tokenSymbol The symbol of the path to remove\\n */\\n function removePath(string memory _tokenSymbol) public virtual onlyOwner {\\n delete eligibleSwapPaths[eligibleSwapPathsBySymbol[_tokenSymbol][0]];\\n delete eligibleSwapPathsBySymbol[_tokenSymbol];\\n }\\n\\n /**\\n * @notice Cheks if Pool Token is eligible for Offsetting.\\n * @param _poolToken The addresses of the pool token to redeem\\n * @return _isEligible Returns if token can be redeemed\\n */\\n\\n function isPoolAddressEligible(\\n address _poolToken\\n ) public view returns (bool _isEligible) {\\n _isEligible = isRedeemable(_poolToken);\\n }\\n\\n /**\\n * @notice Change or add pool token addresses.\\n * @param _poolToken The address of the pool token to add\\n */\\n function addPoolToken(address _poolToken) public virtual onlyOwner {\\n poolAddresses.push(_poolToken);\\n }\\n\\n /**\\n * @notice Delete eligible pool token addresses stored in the contract.\\n * @param _poolToken The address of the pool token to remove\\n */\\n function removePoolToken(address _poolToken) public virtual onlyOwner {\\n for (uint256 i; i < poolAddresses.length; i++) {\\n if (poolAddresses[i] == _poolToken) {\\n poolAddresses[i] = poolAddresses[poolAddresses.length - 1];\\n poolAddresses.pop();\\n break;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf85a61eab51c68683a095be0c776a9a99bf70aa2dc5c65863176be9c17fb0c12\",\"license\":\"GPL-3.0\"},\"contracts/OffsetHelperStorage.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2022 Toucan Labs\\n//\\n// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract OffsetHelperStorage is Ownable {\\n // token symbol => token address\\n mapping(address => address[]) public eligibleSwapPaths;\\n mapping(string => address[]) public eligibleSwapPathsBySymbol;\\n\\n address[] public poolAddresses;\\n string[] public tokenSymbolsForPaths;\\n address[][] public paths;\\n address public dexRouterAddress;\\n}\\n\",\"keccak256\":\"0x6cd0dc999b167d00debeec534e1637cbefa552bdb801e672a20915b90bab20d0\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IToucanCarbonOffsets.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\\\";\\n\\nimport \\\"../types/CarbonProjectTypes.sol\\\";\\nimport \\\"../types/CarbonProjectVintageTypes.sol\\\";\\n\\ninterface IToucanCarbonOffsets is IERC20Upgradeable, IERC721Receiver {\\n function getGlobalProjectVintageIdentifiers()\\n external\\n view\\n returns (string memory, string memory);\\n\\n function getAttributes()\\n external\\n view\\n returns (ProjectData memory, VintageData memory);\\n\\n function getRemaining() external view returns (uint256 remaining);\\n\\n function getDepositCap() external view returns (uint256);\\n\\n function retire(uint256 amount) external;\\n\\n function retireFrom(address account, uint256 amount) external;\\n\\n function mintCertificateLegacy(\\n string calldata retiringEntityString,\\n address beneficiary,\\n string calldata beneficiaryString,\\n string calldata retirementMessage,\\n uint256 amount\\n ) external;\\n\\n function retireAndMintCertificate(\\n string calldata retiringEntityString,\\n address beneficiary,\\n string calldata beneficiaryString,\\n string calldata retirementMessage,\\n uint256 amount\\n ) external;\\n}\\n\",\"keccak256\":\"0x46c4ed2acd84764d0dd68c9c475e2c6ec3229a686046db48aca77ccd298d4b48\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/IToucanContractRegistry.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\npragma solidity ^0.8.0;\\n\\ninterface IToucanContractRegistry {\\n function carbonOffsetBatchesAddress() external view returns (address);\\n\\n function carbonProjectsAddress() external view returns (address);\\n\\n function carbonProjectVintagesAddress() external view returns (address);\\n\\n function toucanCarbonOffsetsFactoryAddress()\\n external\\n view\\n returns (address);\\n\\n function carbonOffsetBadgesAddress() external view returns (address);\\n\\n function checkERC20(address _address) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xa8451ff2527948e4eed26e97247b979212ccb3bd89506302b6c09ddbad392035\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/IToucanPoolToken.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\n\\ninterface IToucanPoolToken is IERC20Upgradeable {\\n function deposit(address erc20Addr, uint256 amount) external;\\n\\n function checkEligible(address erc20Addr) external view returns (bool);\\n\\n function checkAttributeMatching(address erc20Addr)\\n external\\n view\\n returns (bool);\\n\\n function calculateRedeemFees(\\n address[] memory tco2s,\\n uint256[] memory amounts\\n ) external view returns (uint256);\\n\\n function redeemMany(address[] memory tco2s, uint256[] memory amounts)\\n external;\\n\\n function redeemAuto(uint256 amount) external;\\n\\n function redeemAuto2(uint256 amount)\\n external\\n returns (address[] memory tco2s, uint256[] memory amounts);\\n\\n function getRemaining() external view returns (uint256);\\n\\n function getScoredTCO2s() external view returns (address[] memory);\\n}\\n\",\"keccak256\":\"0xef39949a81cf4ed78d789a1aac5c5860de1582be70de7435f1671931091d43a7\",\"license\":\"UNLICENSED\"},\"contracts/types/CarbonProjectTypes.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @dev CarbonProject related data and attributes\\nstruct ProjectData {\\n string projectId;\\n string standard;\\n string methodology;\\n string region;\\n string storageMethod;\\n string method;\\n string emissionType;\\n string category;\\n string uri;\\n address controller;\\n}\\n\",\"keccak256\":\"0x10d52f79d4bb8dbfe0abbb1662059d6d0193fe5794977b66aacf741451e25401\",\"license\":\"UNLICENSED\"},\"contracts/types/CarbonProjectVintageTypes.sol\":{\"content\":\"// SPDX-FileCopyrightText: 2021 Toucan Labs\\n//\\n// SPDX-License-Identifier: UNLICENSED\\n\\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\nstruct VintageData {\\n /// @dev A human-readable string which differentiates this from other vintages in\\n /// the same project, and helps build the corresponding TCO2 name and symbol.\\n string name;\\n uint64 startTime; // UNIX timestamp\\n uint64 endTime; // UNIX timestamp\\n uint256 projectTokenId;\\n uint64 totalVintageQuantity;\\n bool isCorsiaCompliant;\\n bool isCCPcompliant;\\n string coBenefits;\\n string correspAdjustment;\\n string additionalCertification;\\n string uri;\\n}\\n\",\"keccak256\":\"0x3a52e88a48b87f1ca3992c201f8b786ccf3aeb74796510893f8e33b33eae251b\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b5060405162003c5338038062003c538339810160408190526200003491620005df565b6200003f3362000207565b83516200005490600390602087019062000257565b5082516200006a906004906020860190620002c1565b5081516200008090600590602085019062000321565b50600680546001600160a01b0319166001600160a01b038316179055825160005b81811015620001fb57838181518110620000cb57634e487b7160e01b600052603260045260246000fd5b602002602001015160016000868481518110620000f857634e487b7160e01b600052603260045260246000fd5b60200260200101516000815181106200012157634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002090805190602001906200015e92919062000257565b508381815181106200018057634e487b7160e01b600052603260045260246000fd5b60200260200101516002868381518110620001ab57634e487b7160e01b600052603260045260246000fd5b6020026020010151604051620001c2919062000756565b90815260200160405180910390209080519060200190620001e592919062000257565b5080620001f2816200083d565b915050620000a1565b5050505050506200087b565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b828054828255906000526020600020908101928215620002af579160200282015b82811115620002af57825182546001600160a01b0319166001600160a01b0390911617825560209092019160019091019062000278565b50620002bd92915062000381565b5090565b82805482825590600052602060002090810192821562000313579160200282015b828111156200031357825180516200030291849160209091019062000398565b5091602001919060010190620002e2565b50620002bd92915062000415565b82805482825590600052602060002090810192821562000373579160200282015b828111156200037357825180516200036291849160209091019062000257565b509160200191906001019062000342565b50620002bd92915062000436565b5b80821115620002bd576000815560010162000382565b828054620003a69062000800565b90600052602060002090601f016020900481019282620003ca5760008555620002af565b82601f10620003e557805160ff1916838001178555620002af565b82800160010185558215620002af579182015b82811115620002af578251825591602001919060010190620003f8565b80821115620002bd5760006200042c828262000457565b5060010162000415565b80821115620002bd5760006200044d828262000499565b5060010162000436565b508054620004659062000800565b6000825580601f1062000476575050565b601f01602090049060005260206000209081019062000496919062000381565b50565b508054600082559060005260206000209081019062000496919062000381565b80516001600160a01b0381168114620004d157600080fd5b919050565b600082601f830112620004e7578081fd5b8151602062000500620004fa83620007a7565b62000774565b80838252828201915082860187848660051b890101111562000520578586fd5b855b8581101562000549576200053682620004b9565b8452928401929084019060010162000522565b5090979650505050505050565b600082601f83011262000567578081fd5b815160206200057a620004fa83620007a7565b80838252828201915082860187848660051b89010111156200059a578586fd5b855b85811015620005495781516001600160401b03811115620005bb578788fd5b620005cb8a87838c0101620004d6565b85525092840192908401906001016200059c565b60008060008060808587031215620005f5578384fd5b84516001600160401b03808211156200060c578586fd5b6200061a88838901620004d6565b9550602087015191508082111562000630578485fd5b818701915087601f83011262000644578485fd5b815162000655620004fa82620007a7565b80828252602082019150602085018b60208560051b880101111562000678578889fd5b885b84811015620007105781518681111562000692578a8bfd5b8701603f81018e13620006a3578a8bfd5b602081015187811115620006bb57620006bb62000865565b620006d0601f8201601f191660200162000774565b8181528f6040838501011115620006e5578c8dfd5b620006f8826020830160408601620007cd565b8652505060209384019391909101906001016200067a565b505060408a015190975093505050808211156200072b578384fd5b506200073a8782880162000556565b9250506200074b60608601620004b9565b905092959194509250565b600082516200076a818460208701620007cd565b9190910192915050565b604051601f8201601f191681016001600160401b03811182821017156200079f576200079f62000865565b604052919050565b60006001600160401b03821115620007c357620007c362000865565b5060051b60200190565b60005b83811015620007ea578181015183820152602001620007d0565b83811115620007fa576000848401525b50505050565b600181811c908216806200081557607f821691505b602082108114156200083757634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156200085e57634e487b7160e01b81526011600452602481fd5b5060010190565b634e487b7160e01b600052604160045260246000fd5b6133c8806200088b6000396000f3fe6080604052600436106101d15760003560e01c80638da5cb5b116100f7578063c0681c3d11610095578063e7f67fb111610064578063e7f67fb11461054e578063f04ad9d71461056e578063f2fde38b14610581578063feb21b9c146105a157600080fd5b8063c0681c3d146104db578063c6c53efb146104fb578063d08ec4751461051b578063d8a90c401461053b57600080fd5b8063a0cd6049116100d1578063a0cd60491461044b578063a2844a861461046b578063b4e76a861461049b578063b8baf9db146104bb57600080fd5b80638da5cb5b146103ed5780639753209d1461040b578063a09457221461042b57600080fd5b80635367cd9c1161016f578063715018a61161013e578063715018a61461037857806373200b111461038d57806382155e7e146103ad5780638474c288146103cd57600080fd5b80635367cd9c146102eb57806356a7de0d146102fe57806368d306d91461031e5780636d4565041461034b57600080fd5b80631a0fdecc116101ab5780631a0fdecc1461026a5780632e98c8141461028a57806335bab7e5146102ab5780634865b2b4146102cb57600080fd5b80631109ec99146101dd5780631357b113146102105780631661f8181461024857600080fd5b366101d857005b600080fd5b3480156101e957600080fd5b506101fd6101f8366004612ca7565b6105c1565b6040519081526020015b60405180910390f35b34801561021c57600080fd5b5061023061022b366004612ca7565b610695565b6040516001600160a01b039091168152602001610207565b34801561025457600080fd5b50610268610263366004612cd2565b6106cd565b005b34801561027657600080fd5b506101fd610285366004612c67565b61094a565b61029d610298366004612ca7565b6109dd565b6040516102079291906130a4565b3480156102b757600080fd5b506101fd6102c6366004612c67565b610a3a565b3480156102d757600080fd5b506101fd6102e6366004612c67565b610ba8565b6102686102f9366004612ca7565b610c33565b34801561030a57600080fd5b50610268610319366004612c44565b610eb9565b34801561032a57600080fd5b5061033e610339366004612c44565b611005565b6040516102079190613091565b34801561035757600080fd5b5061036b610366366004612f74565b61107b565b6040516102079190613107565b34801561038457600080fd5b50610268611127565b34801561039957600080fd5b506102306103a8366004612f31565b61113b565b3480156103b957600080fd5b5061029d6103c8366004612ca7565b611166565b3480156103d957600080fd5b506102686103e8366004612c67565b611322565b3480156103f957600080fd5b506000546001600160a01b0316610230565b34801561041757600080fd5b50610268610426366004612ea7565b6115ae565b34801561043757600080fd5b5061029d610446366004612c67565b611652565b34801561045757600080fd5b5061029d610466366004612c67565b611686565b34801561047757600080fd5b5061048b610486366004612c44565b6116b5565b6040519015158152602001610207565b3480156104a757600080fd5b506101fd6104b6366004612ca7565b6116c6565b3480156104c757600080fd5b506102686104d6366004612eda565b6117ba565b3480156104e757600080fd5b506102686104f6366004612c44565b61189f565b34801561050757600080fd5b50610230610516366004612fa4565b6118f9565b34801561052757600080fd5b5061029d610536366004612ca7565b611921565b6101fd610549366004612c44565b611939565b34801561055a57600080fd5b50600654610230906001600160a01b031681565b61029d61057c366004612c44565b611adc565b34801561058d57600080fd5b5061026861059c366004612c44565b611b3b565b3480156105ad57600080fd5b506102306105bc366004612f74565b611bb1565b6000826105cd81611bdb565b6105f25760405162461bcd60e51b81526004016105e990613171565b60405180910390fd5b6000600260405161060f9065574d4154494360d01b815260060190565b908152602001604051809103902060008154811061063d57634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b0316915061065e828787611c53565b9150508060008151811061068257634e487b7160e01b600052603260045260246000fd5b6020026020010151935050505092915050565b600160205281600052604060002081815481106106b157600080fd5b6000918252602090912001546001600160a01b03169150829050565b81518061070a5760405162461bcd60e51b815260206004820152600b60248201526a417272617920656d70747960a81b60448201526064016105e9565b8151811461072a5760405162461bcd60e51b81526004016105e9906131a0565b60005b818110156109445782818151811061075557634e487b7160e01b600052603260045260246000fd5b60200260200101516000141561076a57610932565b82818151811061078a57634e487b7160e01b600052603260045260246000fd5b60200260200101518482815181106107b257634e487b7160e01b600052603260045260246000fd5b60209081029190910101516040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b1580156107fd57600080fd5b505afa158015610811573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108359190612f8c565b10156108835760405162461bcd60e51b815260206004820152601960248201527f496e73756666696369656e742054434f322062616c616e63650000000000000060448201526064016105e9565b8381815181106108a357634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316633790cf578483815181106108d957634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b81526004016108ff91815260200190565b600060405180830381600087803b15801561091957600080fd5b505af115801561092d573d6000803e3d6000fd5b505050505b8061093c81613336565b91505061072d565b50505050565b60008361095681611d93565b6109725760405162461bcd60e51b81526004016105e99061313a565b8361097c81611bdb565b6109985760405162461bcd60e51b81526004016105e990613171565b60006109a5878787611c53565b915050806000815181106109c957634e487b7160e01b600052603260045260246000fd5b602002602001015193505050509392505050565b60608061a4ec46141580156109f4575061aef34614155b610a105760405162461bcd60e51b81526004016105e9906131c8565b610a1a8484610c33565b610a248484611166565b9092509050610a3382826106cd565b9250929050565b600083610a4681611d93565b610a625760405162461bcd60e51b81526004016105e99061313a565b83610a6c81611bdb565b610a885760405162461bcd60e51b81526004016105e990613171565b6000610a948787611e2c565b8051909150610aae6001600160a01b03891633308961242a565b600654610ac8906001600160a01b038a8116911688612495565b6000610adc6006546001600160a01b031690565b6001600160a01b03166338ed17398860008630426040518663ffffffff1660e01b8152600401610b10959493929190613227565b600060405180830381600087803b158015610b2a57600080fd5b505af1158015610b3e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b669190810190612e54565b905080610b746001846132b8565b81518110610b9257634e487b7160e01b600052603260045260246000fd5b6020026020010151955050505050509392505050565b600083610bb481611d93565b610bd05760405162461bcd60e51b81526004016105e99061313a565b83610bda81611bdb565b610bf65760405162461bcd60e51b81526004016105e990613171565b6000610c038787876125b9565b9150508060018251610c1591906132b8565b815181106109c957634e487b7160e01b600052603260045260246000fd5b61a4ec4614158015610c47575061aef34614155b610c635760405162461bcd60e51b81526004016105e9906131c8565b81610c6d81611bdb565b610c895760405162461bcd60e51b81526004016105e990613171565b60006002604051610ca69065574d4154494360d01b815260060190565b9081526020016040518091039020600081548110610cd457634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b03169150610cf48286611e2c565b90506000610d0a6006546001600160a01b031690565b6001600160a01b031663fb3bdb4134878530426040518663ffffffff1660e01b8152600401610d3c94939291906130d2565b6000604051808303818588803b158015610d5557600080fd5b505af1158015610d69573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052610d929190810190612e54565b905080600081518110610db557634e487b7160e01b600052603260045260246000fd5b6020026020010151341115610eb157600081600081518110610de757634e487b7160e01b600052603260045260246000fd5b602002602001015134610dfa91906132b8565b604080516000808252602082019283905292935033918491610e1b91613037565b60006040518083038185875af1925050503d8060008114610e58576040519150601f19603f3d011682016040523d82523d6000602084013e610e5d565b606091505b5050905080610eae5760405162461bcd60e51b815260206004820152601b60248201527f4661696c656420746f2073656e6420737572706c7573206261636b000000000060448201526064016105e9565b50505b505050505050565b610ec16126ef565b60005b60035481101561100157816001600160a01b031660038281548110610ef957634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415610fef5760038054610f24906001906132b8565b81548110610f4257634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600380546001600160a01b039092169183908110610f7c57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506003805480610fc957634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b03191690550190555050565b80610ff981613336565b915050610ec4565b5050565b6001600160a01b03811660009081526001602090815260409182902080548351818402810184019094528084526060939283018282801561106f57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611051575b50505050509050919050565b6004818154811061108b57600080fd5b9060005260206000200160009150905080546110a6906132fb565b80601f01602080910402602001604051908101604052809291908181526020018280546110d2906132fb565b801561111f5780601f106110f45761010080835404028352916020019161111f565b820191906000526020600020905b81548152906001019060200180831161110257829003601f168201915b505050505081565b61112f6126ef565b6111396000612749565b565b815160208184018101805160028252928201918501919091209190528054829081106106b157600080fd5b6060808361117381611bdb565b61118f5760405162461bcd60e51b81526004016105e990613171565b6040516370a0823160e01b815230600482015284906001600160a01b038716906370a082319060240160206040518083038186803b1580156111d057600080fd5b505afa1580156111e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112089190612f8c565b10156112565760405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e74204e43542f4243542062616c616e63650000000060448201526064016105e9565b604051634c02cad160e01b81526004810185905285906001600160a01b03821690634c02cad190602401600060405180830381600087803b15801561129a57600080fd5b505af11580156112ae573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526112d69190810190612d8e565b60405191955093507f3d29f82a20ec733db9f357c4dc1ae0ee60c572cc4b877384aa4639e4d877b18890611311903390899088908890613053565b60405180910390a150509250929050565b8261132c81611d93565b6113485760405162461bcd60e51b81526004016105e99061313a565b8261135281611bdb565b61136e5760405162461bcd60e51b81526004016105e990613171565b60008061137c878787611c53565b915091506000816000815181106113a357634e487b7160e01b600052603260045260246000fd5b602090810291909101015190506113c56001600160a01b03891633308461242a565b60065460405163095ea7b360e01b81526001600160a01b039182166004820152602481018390529089169063095ea7b390604401602060405180830381600087803b15801561141357600080fd5b505af1158015611427573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144b9190612e87565b5060006114606006546001600160a01b031690565b6001600160a01b0316638803dbee88848730426040518663ffffffff1660e01b8152600401611493959493929190613227565b600060405180830381600087803b1580156114ad57600080fd5b505af11580156114c1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526114e99190810190612e54565b9050818160008151811061150d57634e487b7160e01b600052603260045260246000fd5b602002602001015110156115a35760065460405163095ea7b360e01b81526001600160a01b03918216600482015260006024820152908a169063095ea7b390604401602060405180830381600087803b15801561156957600080fd5b505af115801561157d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a19190612e87565b505b505050505050505050565b6115b66126ef565b600160006002836040516115ca9190613037565b90815260200160405180910390206000815481106115f857634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528201929092526040018120611625916129f8565b6002816040516116359190613037565b9081526020016040518091039020600061164f91906129f8565b50565b6060806000611662868686610a3a565b905061166e8582611166565b909350915061167d83836106cd565b50935093915050565b606080611694858585611322565b61169e8484611166565b90925090506116ad82826106cd565b935093915050565b60006116c082611bdb565b92915050565b600061a4ec46141580156116dc575061aef34614155b6116f85760405162461bcd60e51b81526004016105e9906131c8565b8261170281611bdb565b61171e5760405162461bcd60e51b81526004016105e990613171565b6000600260405161173b9065574d4154494360d01b815260060190565b908152602001604051809103902060008154811061176957634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b0316915061178a8287876125b9565b915050806001825161179c91906132b8565b8151811061068257634e487b7160e01b600052603260045260246000fd5b6117c26126ef565b8060016000836000815181106117e857634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000209080519060200190611823929190612a16565b50806002836040516118359190613037565b90815260200160405180910390209080519060200190611856929190612a16565b5060048054600181018255600091909152825161189a917f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b01906020850190612a7b565b505050565b6118a76126ef565b600380546001810182556000919091527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b0319166001600160a01b0392909216919091179055565b6005828154811061190957600080fd5b9060005260206000200181815481106106b157600080fd5b606080610a1a6001600160a01b03851633308661242a565b600061a4ec461415801561194f575061aef34614155b61196b5760405162461bcd60e51b81526004016105e9906131c8565b8161197581611bdb565b6119915760405162461bcd60e51b81526004016105e990613171565b60405165574d4154494360d01b8152349060009060029060060190815260200160405180910390206000815481106119d957634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b031691506119f98287611e2c565b80519091506000611a126006546001600160a01b031690565b6001600160a01b0316637ff36ab58660008630426040518663ffffffff1660e01b8152600401611a4594939291906130d2565b6000604051808303818588803b158015611a5e57600080fd5b505af1158015611a72573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052611a9b9190810190612e54565b905080611aa96001846132b8565b81518110611ac757634e487b7160e01b600052603260045260246000fd5b60200260200101519650505050505050919050565b60608061a4ec4614158015611af3575061aef34614155b611b0f5760405162461bcd60e51b81526004016105e9906131c8565b6000611b1a84611939565b9050611b268482611166565b9093509150611b3583836106cd565b50915091565b611b436126ef565b6001600160a01b038116611ba85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105e9565b61164f81612749565b60038181548110611bc157600080fd5b6000918252602090912001546001600160a01b0316905081565b6000805b600354811015611c4a57826001600160a01b031660038281548110611c1457634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415611c385750600192915050565b80611c4281613336565b915050611bdf565b50600092915050565b606080611c608585611e2c565b8051909250611c776006546001600160a01b031690565b6001600160a01b0316631f00ca7485856040518363ffffffff1660e01b8152600401611ca492919061320e565b60006040518083038186803b158015611cbc57600080fd5b505afa158015611cd0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611cf89190810190612e54565b915081518114611d1a5760405162461bcd60e51b81526004016105e9906131a0565b81611d266001836132b8565b81518110611d4457634e487b7160e01b600052603260045260246000fd5b6020026020010151841461167d5760405162461bcd60e51b815260206004820152601660248201527509eeae8e0eae840c2dadeeadce840dad2e6dac2e8c6d60531b60448201526064016105e9565b6000805b600554811015611c4a57826001600160a01b031660058281548110611dcc57634e487b7160e01b600052603260045260246000fd5b90600052602060002001600081548110611df657634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415611e1a5750600192915050565b80611e2481613336565b915050611d97565b6001600160a01b038216600090815260016020819052604090912054606091811415611efc5760408051600280825260608201835290916020830190803683370190505091508382600081518110611e9457634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508282600181518110611ed657634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050506116c0565b806002141561202e576040805160038082526080820190925290602082016060803683370190505091508382600081518110611f4857634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505060016000856001600160a01b03166001600160a01b03168152602001908152602001600020600181548110611fad57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b031682600181518110611fec57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508282600281518110611ed657634e487b7160e01b600052603260045260246000fd5b80600314156121eb57604080516003808252608082019092529060208201606080368337019050509150838260008151811061207a57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505060016000856001600160a01b03166001600160a01b031681526020019081526020016000206001815481106120df57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260018151811061211e57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526001909152604090208054600290811061216a57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826002815181106121a957634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508282600381518110611ed657634e487b7160e01b600052603260045260246000fd5b60408051600480825260a082019092529060208201608080368337019050509150838260008151811061222e57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505060016000856001600160a01b03166001600160a01b0316815260200190815260200160002060018154811061229357634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826001815181106122d257634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526001909152604090208054600290811061231e57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260028151811061235d57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092018101919091529085166000908152600190915260409020805460039081106123a957634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826003815181106123e857634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508282600481518110611ed657634e487b7160e01b600052603260045260246000fd5b6040516001600160a01b03808516602483015283166044820152606481018290526109449085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612799565b80158061251e5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b1580156124e457600080fd5b505afa1580156124f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061251c9190612f8c565b155b6125895760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016105e9565b6040516001600160a01b03831660248201526044810182905261189a90849063095ea7b360e01b9060640161245e565b6060806125c68585611e2c565b80519092506125dd6006546001600160a01b031690565b6001600160a01b031663d06ca61f85856040518363ffffffff1660e01b815260040161260a92919061320e565b60006040518083038186803b15801561262257600080fd5b505afa158015612636573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261265e9190810190612e54565b9150815181146126805760405162461bcd60e51b81526004016105e9906131a0565b816000815181106126a157634e487b7160e01b600052603260045260246000fd5b6020026020010151841461167d5760405162461bcd60e51b8152602060048201526015602482015274092dce0eae840c2dadeeadce840dad2e6dac2e8c6d605b1b60448201526064016105e9565b6000546001600160a01b031633146111395760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105e9565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006127ee826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661286b9092919063ffffffff16565b80519091501561189a578080602001905181019061280c9190612e87565b61189a5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016105e9565b606061287a8484600085612882565b949350505050565b6060824710156128e35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016105e9565b600080866001600160a01b031685876040516128ff9190613037565b60006040518083038185875af1925050503d806000811461293c576040519150601f19603f3d011682016040523d82523d6000602084013e612941565b606091505b50915091506129528783838761295d565b979650505050505050565b606083156129c95782516129c2576001600160a01b0385163b6129c25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105e9565b508161287a565b61287a83838151156129de5781518083602001fd5b8060405162461bcd60e51b81526004016105e99190613107565b508054600082559060005260206000209081019061164f9190612aef565b828054828255906000526020600020908101928215612a6b579160200282015b82811115612a6b57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190612a36565b50612a77929150612aef565b5090565b828054612a87906132fb565b90600052602060002090601f016020900481019282612aa95760008555612a6b565b82601f10612ac257805160ff1916838001178555612a6b565b82800160010185558215612a6b579182015b82811115612a6b578251825591602001919060010190612ad4565b5b80821115612a775760008155600101612af0565b600082601f830112612b14578081fd5b81356020612b29612b2483613294565b613263565b80838252828201915082860187848660051b8901011115612b48578586fd5b855b85811015612b6f578135612b5d8161337d565b84529284019290840190600101612b4a565b5090979650505050505050565b600082601f830112612b8c578081fd5b81516020612b9c612b2483613294565b80838252828201915082860187848660051b8901011115612bbb578586fd5b855b85811015612b6f57815184529284019290840190600101612bbd565b600082601f830112612be9578081fd5b813567ffffffffffffffff811115612c0357612c03613367565b612c16601f8201601f1916602001613263565b818152846020838601011115612c2a578283fd5b816020850160208301379081016020019190915292915050565b600060208284031215612c55578081fd5b8135612c608161337d565b9392505050565b600080600060608486031215612c7b578182fd5b8335612c868161337d565b92506020840135612c968161337d565b929592945050506040919091013590565b60008060408385031215612cb9578182fd5b8235612cc48161337d565b946020939093013593505050565b60008060408385031215612ce4578182fd5b823567ffffffffffffffff80821115612cfb578384fd5b612d0786838701612b04565b9350602091508185013581811115612d1d578384fd5b85019050601f81018613612d2f578283fd5b8035612d3d612b2482613294565b80828252848201915084840189868560051b8701011115612d5c578687fd5b8694505b83851015612d7e578035835260019490940193918501918501612d60565b5080955050505050509250929050565b60008060408385031215612da0578182fd5b825167ffffffffffffffff80821115612db7578384fd5b818501915085601f830112612dca578384fd5b81516020612dda612b2483613294565b8083825282820191508286018a848660051b8901011115612df9578889fd5b8896505b84871015612e24578051612e108161337d565b835260019690960195918301918301612dfd565b5091880151919650909350505080821115612e3d578283fd5b50612e4a85828601612b7c565b9150509250929050565b600060208284031215612e65578081fd5b815167ffffffffffffffff811115612e7b578182fd5b61287a84828501612b7c565b600060208284031215612e98578081fd5b81518015158114612c60578182fd5b600060208284031215612eb8578081fd5b813567ffffffffffffffff811115612ece578182fd5b61287a84828501612bd9565b60008060408385031215612eec578182fd5b823567ffffffffffffffff80821115612f03578384fd5b612f0f86838701612bd9565b93506020850135915080821115612f24578283fd5b50612e4a85828601612b04565b60008060408385031215612f43578182fd5b823567ffffffffffffffff811115612f59578283fd5b612f6585828601612bd9565b95602094909401359450505050565b600060208284031215612f85578081fd5b5035919050565b600060208284031215612f9d578081fd5b5051919050565b60008060408385031215612fb6578182fd5b50508035926020909101359150565b6000815180845260208085019450808401835b83811015612ffd5781516001600160a01b031687529582019590820190600101612fd8565b509495945050505050565b6000815180845260208085019450808401835b83811015612ffd5781518752958201959082019060010161301b565b600082516130498184602087016132cf565b9190910192915050565b6001600160a01b0385811682528416602082015260806040820181905260009061307f90830185612fc5565b82810360608401526129528185613008565b602081526000612c606020830184612fc5565b6040815260006130b76040830185612fc5565b82810360208401526130c98185613008565b95945050505050565b8481526080602082015260006130eb6080830186612fc5565b6001600160a01b03949094166040830152506060015292915050565b60208152600082518060208401526131268160408501602087016132cf565b601f01601f19169190910160400192915050565b60208082526017908201527f5061746820646f65736e2774207965742065786973742e000000000000000000604082015260600190565b6020808252601590820152742a37b5b2b7103737ba103932b232b2b6b0b136329760591b604082015260600190565b6020808252600e908201526d105c9c985e5cc81d5b995c5d585b60921b604082015260600190565b60208082526026908201527f5468652066756e6374696f6e206973206e6f7420617661696c61626c65206f6e6040820152651021b2b6379760d11b606082015260800190565b82815260406020820152600061287a6040830184612fc5565b85815284602082015260a06040820152600061324660a0830186612fc5565b6001600160a01b0394909416606083015250608001529392505050565b604051601f8201601f1916810167ffffffffffffffff8111828210171561328c5761328c613367565b604052919050565b600067ffffffffffffffff8211156132ae576132ae613367565b5060051b60200190565b6000828210156132ca576132ca613351565b500390565b60005b838110156132ea5781810151838201526020016132d2565b838111156109445750506000910152565b600181811c9082168061330f57607f821691505b6020821081141561333057634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561334a5761334a613351565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461164f57600080fdfea2646970667358221220ddc1eff4a35a6fbb1eda6b442a738a64ebb110c6ec2e6fa36a3949ae7d1985ea64736f6c63430008040033", + "deployedBytecode": "0x6080604052600436106101d15760003560e01c80638da5cb5b116100f7578063c0681c3d11610095578063e7f67fb111610064578063e7f67fb11461054e578063f04ad9d71461056e578063f2fde38b14610581578063feb21b9c146105a157600080fd5b8063c0681c3d146104db578063c6c53efb146104fb578063d08ec4751461051b578063d8a90c401461053b57600080fd5b8063a0cd6049116100d1578063a0cd60491461044b578063a2844a861461046b578063b4e76a861461049b578063b8baf9db146104bb57600080fd5b80638da5cb5b146103ed5780639753209d1461040b578063a09457221461042b57600080fd5b80635367cd9c1161016f578063715018a61161013e578063715018a61461037857806373200b111461038d57806382155e7e146103ad5780638474c288146103cd57600080fd5b80635367cd9c146102eb57806356a7de0d146102fe57806368d306d91461031e5780636d4565041461034b57600080fd5b80631a0fdecc116101ab5780631a0fdecc1461026a5780632e98c8141461028a57806335bab7e5146102ab5780634865b2b4146102cb57600080fd5b80631109ec99146101dd5780631357b113146102105780631661f8181461024857600080fd5b366101d857005b600080fd5b3480156101e957600080fd5b506101fd6101f8366004612ca7565b6105c1565b6040519081526020015b60405180910390f35b34801561021c57600080fd5b5061023061022b366004612ca7565b610695565b6040516001600160a01b039091168152602001610207565b34801561025457600080fd5b50610268610263366004612cd2565b6106cd565b005b34801561027657600080fd5b506101fd610285366004612c67565b61094a565b61029d610298366004612ca7565b6109dd565b6040516102079291906130a4565b3480156102b757600080fd5b506101fd6102c6366004612c67565b610a3a565b3480156102d757600080fd5b506101fd6102e6366004612c67565b610ba8565b6102686102f9366004612ca7565b610c33565b34801561030a57600080fd5b50610268610319366004612c44565b610eb9565b34801561032a57600080fd5b5061033e610339366004612c44565b611005565b6040516102079190613091565b34801561035757600080fd5b5061036b610366366004612f74565b61107b565b6040516102079190613107565b34801561038457600080fd5b50610268611127565b34801561039957600080fd5b506102306103a8366004612f31565b61113b565b3480156103b957600080fd5b5061029d6103c8366004612ca7565b611166565b3480156103d957600080fd5b506102686103e8366004612c67565b611322565b3480156103f957600080fd5b506000546001600160a01b0316610230565b34801561041757600080fd5b50610268610426366004612ea7565b6115ae565b34801561043757600080fd5b5061029d610446366004612c67565b611652565b34801561045757600080fd5b5061029d610466366004612c67565b611686565b34801561047757600080fd5b5061048b610486366004612c44565b6116b5565b6040519015158152602001610207565b3480156104a757600080fd5b506101fd6104b6366004612ca7565b6116c6565b3480156104c757600080fd5b506102686104d6366004612eda565b6117ba565b3480156104e757600080fd5b506102686104f6366004612c44565b61189f565b34801561050757600080fd5b50610230610516366004612fa4565b6118f9565b34801561052757600080fd5b5061029d610536366004612ca7565b611921565b6101fd610549366004612c44565b611939565b34801561055a57600080fd5b50600654610230906001600160a01b031681565b61029d61057c366004612c44565b611adc565b34801561058d57600080fd5b5061026861059c366004612c44565b611b3b565b3480156105ad57600080fd5b506102306105bc366004612f74565b611bb1565b6000826105cd81611bdb565b6105f25760405162461bcd60e51b81526004016105e990613171565b60405180910390fd5b6000600260405161060f9065574d4154494360d01b815260060190565b908152602001604051809103902060008154811061063d57634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b0316915061065e828787611c53565b9150508060008151811061068257634e487b7160e01b600052603260045260246000fd5b6020026020010151935050505092915050565b600160205281600052604060002081815481106106b157600080fd5b6000918252602090912001546001600160a01b03169150829050565b81518061070a5760405162461bcd60e51b815260206004820152600b60248201526a417272617920656d70747960a81b60448201526064016105e9565b8151811461072a5760405162461bcd60e51b81526004016105e9906131a0565b60005b818110156109445782818151811061075557634e487b7160e01b600052603260045260246000fd5b60200260200101516000141561076a57610932565b82818151811061078a57634e487b7160e01b600052603260045260246000fd5b60200260200101518482815181106107b257634e487b7160e01b600052603260045260246000fd5b60209081029190910101516040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b1580156107fd57600080fd5b505afa158015610811573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108359190612f8c565b10156108835760405162461bcd60e51b815260206004820152601960248201527f496e73756666696369656e742054434f322062616c616e63650000000000000060448201526064016105e9565b8381815181106108a357634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316633790cf578483815181106108d957634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b81526004016108ff91815260200190565b600060405180830381600087803b15801561091957600080fd5b505af115801561092d573d6000803e3d6000fd5b505050505b8061093c81613336565b91505061072d565b50505050565b60008361095681611d93565b6109725760405162461bcd60e51b81526004016105e99061313a565b8361097c81611bdb565b6109985760405162461bcd60e51b81526004016105e990613171565b60006109a5878787611c53565b915050806000815181106109c957634e487b7160e01b600052603260045260246000fd5b602002602001015193505050509392505050565b60608061a4ec46141580156109f4575061aef34614155b610a105760405162461bcd60e51b81526004016105e9906131c8565b610a1a8484610c33565b610a248484611166565b9092509050610a3382826106cd565b9250929050565b600083610a4681611d93565b610a625760405162461bcd60e51b81526004016105e99061313a565b83610a6c81611bdb565b610a885760405162461bcd60e51b81526004016105e990613171565b6000610a948787611e2c565b8051909150610aae6001600160a01b03891633308961242a565b600654610ac8906001600160a01b038a8116911688612495565b6000610adc6006546001600160a01b031690565b6001600160a01b03166338ed17398860008630426040518663ffffffff1660e01b8152600401610b10959493929190613227565b600060405180830381600087803b158015610b2a57600080fd5b505af1158015610b3e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b669190810190612e54565b905080610b746001846132b8565b81518110610b9257634e487b7160e01b600052603260045260246000fd5b6020026020010151955050505050509392505050565b600083610bb481611d93565b610bd05760405162461bcd60e51b81526004016105e99061313a565b83610bda81611bdb565b610bf65760405162461bcd60e51b81526004016105e990613171565b6000610c038787876125b9565b9150508060018251610c1591906132b8565b815181106109c957634e487b7160e01b600052603260045260246000fd5b61a4ec4614158015610c47575061aef34614155b610c635760405162461bcd60e51b81526004016105e9906131c8565b81610c6d81611bdb565b610c895760405162461bcd60e51b81526004016105e990613171565b60006002604051610ca69065574d4154494360d01b815260060190565b9081526020016040518091039020600081548110610cd457634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b03169150610cf48286611e2c565b90506000610d0a6006546001600160a01b031690565b6001600160a01b031663fb3bdb4134878530426040518663ffffffff1660e01b8152600401610d3c94939291906130d2565b6000604051808303818588803b158015610d5557600080fd5b505af1158015610d69573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052610d929190810190612e54565b905080600081518110610db557634e487b7160e01b600052603260045260246000fd5b6020026020010151341115610eb157600081600081518110610de757634e487b7160e01b600052603260045260246000fd5b602002602001015134610dfa91906132b8565b604080516000808252602082019283905292935033918491610e1b91613037565b60006040518083038185875af1925050503d8060008114610e58576040519150601f19603f3d011682016040523d82523d6000602084013e610e5d565b606091505b5050905080610eae5760405162461bcd60e51b815260206004820152601b60248201527f4661696c656420746f2073656e6420737572706c7573206261636b000000000060448201526064016105e9565b50505b505050505050565b610ec16126ef565b60005b60035481101561100157816001600160a01b031660038281548110610ef957634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415610fef5760038054610f24906001906132b8565b81548110610f4257634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600380546001600160a01b039092169183908110610f7c57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506003805480610fc957634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b03191690550190555050565b80610ff981613336565b915050610ec4565b5050565b6001600160a01b03811660009081526001602090815260409182902080548351818402810184019094528084526060939283018282801561106f57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611051575b50505050509050919050565b6004818154811061108b57600080fd5b9060005260206000200160009150905080546110a6906132fb565b80601f01602080910402602001604051908101604052809291908181526020018280546110d2906132fb565b801561111f5780601f106110f45761010080835404028352916020019161111f565b820191906000526020600020905b81548152906001019060200180831161110257829003601f168201915b505050505081565b61112f6126ef565b6111396000612749565b565b815160208184018101805160028252928201918501919091209190528054829081106106b157600080fd5b6060808361117381611bdb565b61118f5760405162461bcd60e51b81526004016105e990613171565b6040516370a0823160e01b815230600482015284906001600160a01b038716906370a082319060240160206040518083038186803b1580156111d057600080fd5b505afa1580156111e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112089190612f8c565b10156112565760405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e74204e43542f4243542062616c616e63650000000060448201526064016105e9565b604051634c02cad160e01b81526004810185905285906001600160a01b03821690634c02cad190602401600060405180830381600087803b15801561129a57600080fd5b505af11580156112ae573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526112d69190810190612d8e565b60405191955093507f3d29f82a20ec733db9f357c4dc1ae0ee60c572cc4b877384aa4639e4d877b18890611311903390899088908890613053565b60405180910390a150509250929050565b8261132c81611d93565b6113485760405162461bcd60e51b81526004016105e99061313a565b8261135281611bdb565b61136e5760405162461bcd60e51b81526004016105e990613171565b60008061137c878787611c53565b915091506000816000815181106113a357634e487b7160e01b600052603260045260246000fd5b602090810291909101015190506113c56001600160a01b03891633308461242a565b60065460405163095ea7b360e01b81526001600160a01b039182166004820152602481018390529089169063095ea7b390604401602060405180830381600087803b15801561141357600080fd5b505af1158015611427573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144b9190612e87565b5060006114606006546001600160a01b031690565b6001600160a01b0316638803dbee88848730426040518663ffffffff1660e01b8152600401611493959493929190613227565b600060405180830381600087803b1580156114ad57600080fd5b505af11580156114c1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526114e99190810190612e54565b9050818160008151811061150d57634e487b7160e01b600052603260045260246000fd5b602002602001015110156115a35760065460405163095ea7b360e01b81526001600160a01b03918216600482015260006024820152908a169063095ea7b390604401602060405180830381600087803b15801561156957600080fd5b505af115801561157d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a19190612e87565b505b505050505050505050565b6115b66126ef565b600160006002836040516115ca9190613037565b90815260200160405180910390206000815481106115f857634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528201929092526040018120611625916129f8565b6002816040516116359190613037565b9081526020016040518091039020600061164f91906129f8565b50565b6060806000611662868686610a3a565b905061166e8582611166565b909350915061167d83836106cd565b50935093915050565b606080611694858585611322565b61169e8484611166565b90925090506116ad82826106cd565b935093915050565b60006116c082611bdb565b92915050565b600061a4ec46141580156116dc575061aef34614155b6116f85760405162461bcd60e51b81526004016105e9906131c8565b8261170281611bdb565b61171e5760405162461bcd60e51b81526004016105e990613171565b6000600260405161173b9065574d4154494360d01b815260060190565b908152602001604051809103902060008154811061176957634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b0316915061178a8287876125b9565b915050806001825161179c91906132b8565b8151811061068257634e487b7160e01b600052603260045260246000fd5b6117c26126ef565b8060016000836000815181106117e857634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000209080519060200190611823929190612a16565b50806002836040516118359190613037565b90815260200160405180910390209080519060200190611856929190612a16565b5060048054600181018255600091909152825161189a917f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b01906020850190612a7b565b505050565b6118a76126ef565b600380546001810182556000919091527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b0319166001600160a01b0392909216919091179055565b6005828154811061190957600080fd5b9060005260206000200181815481106106b157600080fd5b606080610a1a6001600160a01b03851633308661242a565b600061a4ec461415801561194f575061aef34614155b61196b5760405162461bcd60e51b81526004016105e9906131c8565b8161197581611bdb565b6119915760405162461bcd60e51b81526004016105e990613171565b60405165574d4154494360d01b8152349060009060029060060190815260200160405180910390206000815481106119d957634e487b7160e01b600052603260045260246000fd5b60009182526020822001546001600160a01b031691506119f98287611e2c565b80519091506000611a126006546001600160a01b031690565b6001600160a01b0316637ff36ab58660008630426040518663ffffffff1660e01b8152600401611a4594939291906130d2565b6000604051808303818588803b158015611a5e57600080fd5b505af1158015611a72573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052611a9b9190810190612e54565b905080611aa96001846132b8565b81518110611ac757634e487b7160e01b600052603260045260246000fd5b60200260200101519650505050505050919050565b60608061a4ec4614158015611af3575061aef34614155b611b0f5760405162461bcd60e51b81526004016105e9906131c8565b6000611b1a84611939565b9050611b268482611166565b9093509150611b3583836106cd565b50915091565b611b436126ef565b6001600160a01b038116611ba85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105e9565b61164f81612749565b60038181548110611bc157600080fd5b6000918252602090912001546001600160a01b0316905081565b6000805b600354811015611c4a57826001600160a01b031660038281548110611c1457634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415611c385750600192915050565b80611c4281613336565b915050611bdf565b50600092915050565b606080611c608585611e2c565b8051909250611c776006546001600160a01b031690565b6001600160a01b0316631f00ca7485856040518363ffffffff1660e01b8152600401611ca492919061320e565b60006040518083038186803b158015611cbc57600080fd5b505afa158015611cd0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611cf89190810190612e54565b915081518114611d1a5760405162461bcd60e51b81526004016105e9906131a0565b81611d266001836132b8565b81518110611d4457634e487b7160e01b600052603260045260246000fd5b6020026020010151841461167d5760405162461bcd60e51b815260206004820152601660248201527509eeae8e0eae840c2dadeeadce840dad2e6dac2e8c6d60531b60448201526064016105e9565b6000805b600554811015611c4a57826001600160a01b031660058281548110611dcc57634e487b7160e01b600052603260045260246000fd5b90600052602060002001600081548110611df657634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415611e1a5750600192915050565b80611e2481613336565b915050611d97565b6001600160a01b038216600090815260016020819052604090912054606091811415611efc5760408051600280825260608201835290916020830190803683370190505091508382600081518110611e9457634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508282600181518110611ed657634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050506116c0565b806002141561202e576040805160038082526080820190925290602082016060803683370190505091508382600081518110611f4857634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505060016000856001600160a01b03166001600160a01b03168152602001908152602001600020600181548110611fad57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b031682600181518110611fec57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508282600281518110611ed657634e487b7160e01b600052603260045260246000fd5b80600314156121eb57604080516003808252608082019092529060208201606080368337019050509150838260008151811061207a57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505060016000856001600160a01b03166001600160a01b031681526020019081526020016000206001815481106120df57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260018151811061211e57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526001909152604090208054600290811061216a57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826002815181106121a957634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508282600381518110611ed657634e487b7160e01b600052603260045260246000fd5b60408051600480825260a082019092529060208201608080368337019050509150838260008151811061222e57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505060016000856001600160a01b03166001600160a01b0316815260200190815260200160002060018154811061229357634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826001815181106122d257634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920181019190915290851660009081526001909152604090208054600290811061231e57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168260028151811061235d57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092018101919091529085166000908152600190915260409020805460039081106123a957634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316826003815181106123e857634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508282600481518110611ed657634e487b7160e01b600052603260045260246000fd5b6040516001600160a01b03808516602483015283166044820152606481018290526109449085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612799565b80158061251e5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b1580156124e457600080fd5b505afa1580156124f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061251c9190612f8c565b155b6125895760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016105e9565b6040516001600160a01b03831660248201526044810182905261189a90849063095ea7b360e01b9060640161245e565b6060806125c68585611e2c565b80519092506125dd6006546001600160a01b031690565b6001600160a01b031663d06ca61f85856040518363ffffffff1660e01b815260040161260a92919061320e565b60006040518083038186803b15801561262257600080fd5b505afa158015612636573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261265e9190810190612e54565b9150815181146126805760405162461bcd60e51b81526004016105e9906131a0565b816000815181106126a157634e487b7160e01b600052603260045260246000fd5b6020026020010151841461167d5760405162461bcd60e51b8152602060048201526015602482015274092dce0eae840c2dadeeadce840dad2e6dac2e8c6d605b1b60448201526064016105e9565b6000546001600160a01b031633146111395760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105e9565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006127ee826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661286b9092919063ffffffff16565b80519091501561189a578080602001905181019061280c9190612e87565b61189a5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016105e9565b606061287a8484600085612882565b949350505050565b6060824710156128e35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016105e9565b600080866001600160a01b031685876040516128ff9190613037565b60006040518083038185875af1925050503d806000811461293c576040519150601f19603f3d011682016040523d82523d6000602084013e612941565b606091505b50915091506129528783838761295d565b979650505050505050565b606083156129c95782516129c2576001600160a01b0385163b6129c25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105e9565b508161287a565b61287a83838151156129de5781518083602001fd5b8060405162461bcd60e51b81526004016105e99190613107565b508054600082559060005260206000209081019061164f9190612aef565b828054828255906000526020600020908101928215612a6b579160200282015b82811115612a6b57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190612a36565b50612a77929150612aef565b5090565b828054612a87906132fb565b90600052602060002090601f016020900481019282612aa95760008555612a6b565b82601f10612ac257805160ff1916838001178555612a6b565b82800160010185558215612a6b579182015b82811115612a6b578251825591602001919060010190612ad4565b5b80821115612a775760008155600101612af0565b600082601f830112612b14578081fd5b81356020612b29612b2483613294565b613263565b80838252828201915082860187848660051b8901011115612b48578586fd5b855b85811015612b6f578135612b5d8161337d565b84529284019290840190600101612b4a565b5090979650505050505050565b600082601f830112612b8c578081fd5b81516020612b9c612b2483613294565b80838252828201915082860187848660051b8901011115612bbb578586fd5b855b85811015612b6f57815184529284019290840190600101612bbd565b600082601f830112612be9578081fd5b813567ffffffffffffffff811115612c0357612c03613367565b612c16601f8201601f1916602001613263565b818152846020838601011115612c2a578283fd5b816020850160208301379081016020019190915292915050565b600060208284031215612c55578081fd5b8135612c608161337d565b9392505050565b600080600060608486031215612c7b578182fd5b8335612c868161337d565b92506020840135612c968161337d565b929592945050506040919091013590565b60008060408385031215612cb9578182fd5b8235612cc48161337d565b946020939093013593505050565b60008060408385031215612ce4578182fd5b823567ffffffffffffffff80821115612cfb578384fd5b612d0786838701612b04565b9350602091508185013581811115612d1d578384fd5b85019050601f81018613612d2f578283fd5b8035612d3d612b2482613294565b80828252848201915084840189868560051b8701011115612d5c578687fd5b8694505b83851015612d7e578035835260019490940193918501918501612d60565b5080955050505050509250929050565b60008060408385031215612da0578182fd5b825167ffffffffffffffff80821115612db7578384fd5b818501915085601f830112612dca578384fd5b81516020612dda612b2483613294565b8083825282820191508286018a848660051b8901011115612df9578889fd5b8896505b84871015612e24578051612e108161337d565b835260019690960195918301918301612dfd565b5091880151919650909350505080821115612e3d578283fd5b50612e4a85828601612b7c565b9150509250929050565b600060208284031215612e65578081fd5b815167ffffffffffffffff811115612e7b578182fd5b61287a84828501612b7c565b600060208284031215612e98578081fd5b81518015158114612c60578182fd5b600060208284031215612eb8578081fd5b813567ffffffffffffffff811115612ece578182fd5b61287a84828501612bd9565b60008060408385031215612eec578182fd5b823567ffffffffffffffff80821115612f03578384fd5b612f0f86838701612bd9565b93506020850135915080821115612f24578283fd5b50612e4a85828601612b04565b60008060408385031215612f43578182fd5b823567ffffffffffffffff811115612f59578283fd5b612f6585828601612bd9565b95602094909401359450505050565b600060208284031215612f85578081fd5b5035919050565b600060208284031215612f9d578081fd5b5051919050565b60008060408385031215612fb6578182fd5b50508035926020909101359150565b6000815180845260208085019450808401835b83811015612ffd5781516001600160a01b031687529582019590820190600101612fd8565b509495945050505050565b6000815180845260208085019450808401835b83811015612ffd5781518752958201959082019060010161301b565b600082516130498184602087016132cf565b9190910192915050565b6001600160a01b0385811682528416602082015260806040820181905260009061307f90830185612fc5565b82810360608401526129528185613008565b602081526000612c606020830184612fc5565b6040815260006130b76040830185612fc5565b82810360208401526130c98185613008565b95945050505050565b8481526080602082015260006130eb6080830186612fc5565b6001600160a01b03949094166040830152506060015292915050565b60208152600082518060208401526131268160408501602087016132cf565b601f01601f19169190910160400192915050565b60208082526017908201527f5061746820646f65736e2774207965742065786973742e000000000000000000604082015260600190565b6020808252601590820152742a37b5b2b7103737ba103932b232b2b6b0b136329760591b604082015260600190565b6020808252600e908201526d105c9c985e5cc81d5b995c5d585b60921b604082015260600190565b60208082526026908201527f5468652066756e6374696f6e206973206e6f7420617661696c61626c65206f6e6040820152651021b2b6379760d11b606082015260800190565b82815260406020820152600061287a6040830184612fc5565b85815284602082015260a06040820152600061324660a0830186612fc5565b6001600160a01b0394909416606083015250608001529392505050565b604051601f8201601f1916810167ffffffffffffffff8111828210171561328c5761328c613367565b604052919050565b600067ffffffffffffffff8211156132ae576132ae613367565b5060051b60200190565b6000828210156132ca576132ca613351565b500390565b60005b838110156132ea5781810151838201526020016132d2565b838111156109445750506000910152565b600181811c9082168061330f57607f821691505b6020821081141561333057634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561334a5761334a613351565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461164f57600080fdfea2646970667358221220ddc1eff4a35a6fbb1eda6b442a738a64ebb110c6ec2e6fa36a3949ae7d1985ea64736f6c63430008040033", "devdoc": { "events": { "Redeemed(address,address,address[],uint256[])": { "params": { "amounts": "An array of the amounts of each TCO2 that were redeemed", - "poolToken": "The address of the Toucan pool token used in the redemption, e.g., NCT", + "poolToken": "The address of the pool token used in the redemption, e.g., NCT", "sender": "The sender of the transaction", "tco2s": "An array of the TCO2 addresses that were redeemed" } @@ -898,7 +828,7 @@ "autoOffsetExactInETH(address)": { "details": "This function is only available on Polygon, not on Celo.", "params": { - "_poolToken": "The address of the pool token to offset, e.g., NCT" + "_poolToken": "The address of the pool token to swap for, e.g., NCT" }, "returns": { "amounts": "An array of the amounts of each TCO2 that were redeemed", @@ -906,11 +836,11 @@ } }, "autoOffsetExactInToken(address,address,uint256)": { - "details": "When automatically redeeming pool tokens for the lowest quality TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool token.", + "details": "When automatically redeeming pool tokens for the oldest ones TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool token.", "params": { "_amountToSwap": "The amount of ERC20 token to swap into Toucan pool token. Full amount will be used for offsetting.", "_fromToken": "The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)", - "_poolToken": "The address of the pool token to offset, e.g., NCT" + "_poolToken": "The address of the pool token that the user wants to use, e.g., NCT" }, "returns": { "amounts": "An array of the amounts of each TCO2 that were redeemed", @@ -921,7 +851,7 @@ "details": "If the user sends too much native tokens , the leftover amount will be sent back to the user. This function is only available on Polygon, not on Celo.", "params": { "_amountToOffset": "The amount of TCO2 to offset.", - "_poolToken": "The address of the pool token to offset, e.g., NCT" + "_poolToken": "The address of the pool token to swap for, e.g., NCT" }, "returns": { "amounts": "An array of the amounts of each TCO2 that were redeemed", @@ -929,11 +859,11 @@ } }, "autoOffsetExactOutToken(address,address,uint256)": { - "details": "When automatically redeeming pool tokens for the lowest quality TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool token.", + "details": "When automatically redeeming pool tokens for the oldest ones TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool token.", "params": { "_amountToOffset": "The amount of TCO2 to offset", "_fromToken": "The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)", - "_poolToken": "The address of the Toucan pool token that the user wants to offset, e.g., NCT" + "_poolToken": "The address of the pool token that the user wants to use, e.g., NCT" }, "returns": { "amounts": "An array of the amounts of each TCO2 that were redeemed", @@ -943,7 +873,7 @@ "autoOffsetPoolToken(address,uint256)": { "params": { "_amountToOffset": "The amount of TCO2 to offset.", - "_poolToken": "The address of the pool token to offset, e.g., NCT" + "_poolToken": "The address of the pool token to swap for, e.g., NCT" }, "returns": { "amounts": "An array of the amounts of each TCO2 that were redeemed", @@ -988,7 +918,7 @@ }, "calculateNeededETHAmount(address,uint256)": { "params": { - "_poolToken": "The address of the pool token to swap for, e.g., NCT", + "_poolToken": "The address of the pool token to swap for, for example, NCT", "_toAmount": "The desired amount of pool token to receive" }, "returns": { @@ -1013,9 +943,6 @@ "_tokenSymbolsForPaths": "An array of symbols of the token the user want to retire carbon credits for" } }, - "deposit(address,uint256)": { - "details": "Needs to be approved" - }, "isERC20AddressEligible(address)": { "params": { "_erc20Address": "The address of the ERC20 token that the user sends (e.g., cUSD, cUSD, USDC, WETH, WMATIC)" @@ -1026,10 +953,10 @@ }, "isPoolAddressEligible(address)": { "params": { - "_poolToken": "The address of the pool token to offset, e.g., NCT" + "_poolToken": "The addresses of the pool token to redeem" }, "returns": { - "_isEligible": "Returns a bool if the Pool token is eligible for offsetting" + "_isEligible": "Returns if token can be redeemed" } }, "owner()": { @@ -1053,24 +980,24 @@ "_poolToken": "The address of the pool token to swap for, e.g., NCT" }, "returns": { - "amountOut": "Resulting amount of Toucan pool token that got acquired for the swapped native tokens ." + "amountOut": "Resulting amount of pool token that got acquired for the swapped native tokens ." } }, "swapExactInToken(address,address,uint256)": { "details": "Needs to be approved on the client side.", "params": { - "_fromAmount": "The amount of ERC20 token to swap", + "_fromAmount": "The amount of ERC20 token to swap e.g., NCT", "_fromToken": "The address of the ERC20 token used for the swap", - "_poolToken": "The address of the pool token to swap for, e.g., NCT" + "_poolToken": "The address of the pool token to swap for," }, "returns": { - "amountOut": "Resulting amount of Toucan pool token that got acquired for the swapped ERC20 tokens." + "amountOut": "Resulting amount of pool token that got acquired for the swapped ERC20 tokens." } }, "swapExactOutETH(address,uint256)": { "params": { "_poolToken": "The address of the pool token to swap for, e.g., NCT", - "_toAmount": "The required amount of the Toucan pool token (NCT/BCT)" + "_toAmount": "The required amount of the pool token (NCT/BCT)" } }, "swapExactOutToken(address,address,uint256)": { @@ -1078,7 +1005,7 @@ "params": { "_fromToken": "The address of the ERC20 token used for the swap", "_poolToken": "The address of the pool token to swap for, e.g., NCT", - "_toAmount": "The required amount of the Toucan pool token (NCT/BCT)" + "_toAmount": "The required amount of the pool token (NCT/BCT)" } }, "transferOwnership(address)": { @@ -1103,19 +1030,19 @@ "notice": "Change or add pool token addresses." }, "autoOffsetExactInETH(address)": { - "notice": "Retire carbon credits using the lowest quality (oldest) TCO2 tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC. All provided native tokens is consumed for offsetting. The `view` helper function `calculateExpectedPoolTokenForETH()` can be used to calculate the expected amount of TCO2s that will be offset using `autoOffsetExactInETH()`. This function: 1. Swaps the native token e.g. MATIC sent to the contract for the specified pool token. 2. Redeems the pool token for the poorest quality TCO2 tokens available. 3. Retires the TCO2 tokens." + "notice": "Retire carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC. All provided native tokens is consumed for offsetting. Use `calculateExpectedPoolTokenForETH()` to calculate the expected amount of Pool token that can be acquired by swapping the provided amount of native tokens e.g., MATIC. This function: 1. Swaps the Matic sent to the contract for the specified pool token. 2. Redeems the pool token for the oldest TCO2 tokens available. 3. Retires the TCO2 tokens." }, "autoOffsetExactInToken(address,address,uint256)": { - "notice": "Retire carbon credits using the lowest quality (oldest) TCO2 tokens available from the specified Toucan token pool by sending ERC20 tokens (cUSD, USDC, WETH, WMATIC). All provided token is consumed for offsetting. The `view` helper function `calculateExpectedPoolTokenForToken()` can be used to calculate the expected amount of TCO2s that will be offset using `autoOffsetExactInToken()`. This function: 1. Swaps the ERC20 token sent to the contract for the specified pool token. 2. Redeems the pool token for the poorest quality TCO2 tokens available. 3. Retires the TCO2 tokens. Note: The client must approve the ERC20 token that is sent to the contract." + "notice": "Retire carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending ERC20 tokens (cUSD, USDC, WETH, WMATIC). All provided token is consumed for offsetting. Use `calculateExpectedPoolTokenForToken()` to calculate the expected amount of Pool token that can be acquired by swapping the provided amount of ERC20 token. This function: 1. Swaps the ERC20 token sent to the contract for the specified pool token. 2. Redeems the pool token for the oldest TCO2 tokens available. 3. Retires the TCO2 tokens. Note: The client must approve the ERC20 token that is sent to the contract." }, "autoOffsetExactOutETH(address,uint256)": { - "notice": "Retire carbon credits using the lowest quality (oldest) TCO2 tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC. The `view` helper function `calculateNeededETHAmount()` should be called before using `autoOffsetExactOutETH()`, to determine how much native tokens e.g., MATIC must be sent to the `OffsetHelper` contract in order to retire the specified amount of carbon. This function: 1. Swaps the native token e.g. MATIC sent to the contract for the specified pool token. 2. Redeems the pool token for the poorest quality TCO2 tokens available. 3. Retires the TCO2 tokens." + "notice": "Retire carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC. Use `calculateNeededETHAmount()` first in order to find out how much native tokens are required to retire the specified quantity of TCO2. This function: 1. Swaps the Matic sent to the contract for the specified pool token. 2. Redeems the pool token for the oldest TCO2 tokens available. 3. Retires the TCO2 tokens." }, "autoOffsetExactOutToken(address,address,uint256)": { - "notice": "Retire carbon credits using the lowest quality (oldest) TCO2 tokens available from the specified Toucan token pool by sending ERC20 tokens (cUSD, USDC, WETH, WMATIC). The `view` helper function `calculateNeededTokenAmount()` should be called before using `autoOffsetExactOutToken()`, to determine how much native tokens e.g., MATIC must be sent to the `OffsetHelper` contract in order to retire the specified amount of carbon. This function: 1. Swaps the ERC20 token sent to the contract for the specified pool token. 2. Redeems the pool token for the poorest quality TCO2 tokens available. 3. Retires the TCO2 tokens. Note: The client must approve the ERC20 token that is sent to the contract." + "notice": "Retire carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending ERC20 tokens (cUSD, USDC, WETH, WMATIC). Use `calculateNeededTokenAmount` first in order to find out how much of the ERC20 token is required to retire the specified quantity of TCO2. This function: 1. Swaps the ERC20 token sent to the contract for the specified pool token. 2. Redeems the pool token for the oldest TCO2 tokens available. 3. Retires the TCO2 tokens. Note: The client must approve the ERC20 token that is sent to the contract." }, "autoOffsetPoolToken(address,uint256)": { - "notice": "Retire carbon credits using the lowest quality (oldest) TCO2 tokens available by sending Toucan pool tokens, e.g., NCT. This function: 1. Redeems the pool token for the poorest quality TCO2 tokens available. 2. Retires the TCO2 tokens. Note: The client must approve the pool token that is sent." + "notice": "Retire carbon credits using the oldest TCO2 tokens available by sending pool tokens, e.g., NCT. This function: 1. Redeems the pool token for the oldest TCO2 tokens available. 2. Retires the TCO2 tokens. Note: The client must approve the pool token that is sent." }, "autoRedeem(address,uint256)": { "notice": "Redeems the specified amount of NCT / BCT for TCO2." @@ -1124,28 +1051,25 @@ "notice": "Retire the specified TCO2 tokens." }, "calculateExpectedPoolTokenForETH(address,uint256)": { - "notice": "Calculates the expected amount of Toucan Pool token that can be acquired by swapping the provided amount of native tokens e.g., MATIC." + "notice": "Calculates the expected amount of pool token that can be acquired by swapping the provided amount of native tokens e.g., MATIC." }, "calculateExpectedPoolTokenForToken(address,address,uint256)": { - "notice": "Calculates the expected amount of Toucan Pool token that can be acquired by swapping the provided amount of ERC20 token." + "notice": "Calculates the expected amount of pool token that can be acquired by swapping the provided amount of ERC20 token." }, "calculateNeededETHAmount(address,uint256)": { - "notice": "Return how much native tokens e.g, MATIC is required in order to swap for the desired amount of a Toucan pool token, e.g., NCT." + "notice": "Return how much native tokens e.g, MATIC is required in order to swap for the desired amount of a pool token, e.g., NCT." }, "calculateNeededTokenAmount(address,address,uint256)": { - "notice": "Return how much of the specified ERC20 token is required in order to swap for the desired amount of a Toucan pool token, for example, e.g., NCT." + "notice": "Return how much of the specified ERC20 token is required in order to swap for the desired amount of a pool token, for example, e.g., NCT." }, "constructor": { "notice": "Contract constructor. Should specify arrays of ERC20 symbols and addresses that can used by the contract." }, - "deposit(address,uint256)": { - "notice": "Allow users to deposit BCT / NCT." - }, "isERC20AddressEligible(address)": { - "notice": "Checks if ERC20 Token is eligible for swapping." + "notice": "Checks if ERC20 Token is eligible for Offsetting." }, "isPoolAddressEligible(address)": { - "notice": "Checks if Pool Address is eligible for offsetting." + "notice": "Cheks if Pool Token is eligible for Offsetting." }, "removePath(string)": { "notice": "Delete eligible tokens stored in the contract." @@ -1154,121 +1078,78 @@ "notice": "Delete eligible pool token addresses stored in the contract." }, "swapExactInETH(address)": { - "notice": "Swap native tokens e.g., MATIC for Toucan pool tokens (BCT/NCT) on SushiSwap. All provided native tokens will be swapped." + "notice": "Swap native tokens e.g., MATIC for pool tokens (BCT/NCT) on SushiSwap. All provided native tokens will be swapped." }, "swapExactInToken(address,address,uint256)": { - "notice": "Swap eligible ERC20 tokens for Toucan pool tokens (BCT/NCT) on SushiSwap. All provided ERC20 tokens will be swapped." + "notice": "Swap eligible ERC20 tokens for pool tokens (BCT/NCT) on SushiSwap. All provided ERC20 tokens will be swapped." }, "swapExactOutETH(address,uint256)": { - "notice": "Swap native tokens e.g., MATIC for Toucan pool tokens (BCT/NCT) on SushiSwap. Remaining native tokens that was not consumed by the swap is returned." + "notice": "Swap native tokens e.g., MATIC for pool tokens (BCT/NCT) on SushiSwap. Remaining native tokens that was not consumed by the swap is returned." }, "swapExactOutToken(address,address,uint256)": { - "notice": "Swap eligible ERC20 tokens for Toucan pool tokens (BCT/NCT) on SushiSwap" - }, - "withdraw(address,uint256)": { - "notice": "Allow users to withdraw tokens they have deposited." + "notice": "Swap eligible ERC20 tokens for pool tokens (BCT/NCT) on SushiSwap" } }, - "notice": "Helper functions that simplify the carbon offsetting (retirement) process. Retiring carbon tokens requires multiple steps and interactions with Toucan Protocol's main contracts: 1. Obtain a Toucan pool token e.g., NCT (by performing a token swap on a DEX). 2. Redeem the pool token for a TCO2 token. 3. Retire the TCO2 token. These steps are combined in each of the following \"auto offset\" methods implemented in `OffsetHelper` to allow a retirement within one transaction: - `autoOffsetPoolToken()` if the user already owns a Toucan pool token e.g., NCT, - `autoOffsetExactOutETH()` if the user would like to perform a retirement using native tokens e.g., MATIC, specifying the exact amount of TCO2s to retire (only on Polygon, not on Celo), - `autoOffsetExactInETH()` if the user would like to perform a retirement using native tokens, swapping all sent native tokens into TCO2s (only on Polygon, not on Celo), - `autoOffsetExactOutToken()` if the user would like to perform a retirement using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount of TCO2s to retire, - `autoOffsetExactInToken()` if the user would like to perform a retirement using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount of token to swap into TCO2s. In these methods, \"auto\" refers to the fact that these methods use `autoRedeem()` in order to automatically choose a TCO2 token corresponding to the oldest tokenized carbon project in the specfified token pool. There are no fees incurred by the user when using `autoRedeem()`, i.e., the user receives 1 TCO2 token for each pool token (BCT/NCT) redeemed. There are two `view` helper functions `calculateNeededETHAmount()` and `calculateNeededTokenAmount()` that should be called before using `autoOffsetExactOutETH()` and `autoOffsetExactOutToken()`, to determine how much native tokens e.g., MATIC, respectively how much of the ERC20 token must be sent to the `OffsetHelper` contract in order to retire the specified amount of carbon. The two `view` helper functions `calculateExpectedPoolTokenForETH()` and `calculateExpectedPoolTokenForToken()` can be used to calculate the expected amount of TCO2s that will be offset using functions `autoOffsetExactInETH()` and `autoOffsetExactInToken()`.", + "notice": "Helper functions that simplify the carbon offsetting (retirement) process. Retiring carbon tokens requires multiple steps and interactions with Toucan Protocol's main contracts: 1. Obtain a pool token e.g., NCT (by performing a token swap on a DEX). 2. Redeem the pool token for a TCO2 token. 3. Retire the TCO2 token. These steps are combined in each of the following \"auto offset\" methods implemented in `OffsetHelper` to allow a retirement within one transaction: - `autoOffsetPoolToken()` if the user already owns a Toucan pool token e.g., NCT, - `autoOffsetExactOutETH()` if the user would like to perform a retirement using native tokens e.g., MATIC, specifying the exact amount of TCO2s to retire (only on Polygon, not on Celo), - `autoOffsetExactInETH()` if the user would like to perform a retirement using native tokens, swapping all sent native tokens into TCO2s (only on Polygon, not on Celo), - `autoOffsetExactOutToken()` if the user would like to perform a retirement using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount of TCO2s to retire, - `autoOffsetExactInToken()` if the user would like to perform a retirement using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount of token to swap into TCO2s. In these methods, \"auto\" refers to the fact that these methods use `autoRedeem()` in order to automatically choose a TCO2 token corresponding to the oldest tokenized carbon project in the specfified token pool. There are no fees incurred by the user when using `autoRedeem()`, i.e., the user receives 1 TCO2 token for each pool token (BCT/NCT) redeemed. There are two `view` helper functions `calculateNeededETHAmount()` and `calculateNeededTokenAmount()` that should be called before using `autoOffsetExactOutETH()` and `autoOffsetExactOutToken()`, to determine how much native tokens e.g., MATIC, respectively how much of the ERC20 token must be sent to the `OffsetHelper` contract in order to retire the specified amount of carbon. The two `view` helper functions `calculateExpectedPoolTokenForETH()` and `calculateExpectedPoolTokenForToken()` can be used to calculate the expected amount of TCO2s that will be offset using functions `autoOffsetExactInETH()` and `autoOffsetExactInToken()`.", "version": 1 }, "storageLayout": { "storage": [ { - "astId": 138, - "contract": "contracts/OffsetHelper.sol:OffsetHelper", - "label": "_initialized", - "offset": 0, - "slot": "0", - "type": "t_uint8" - }, - { - "astId": 141, - "contract": "contracts/OffsetHelper.sol:OffsetHelper", - "label": "_initializing", - "offset": 1, - "slot": "0", - "type": "t_bool" - }, - { - "astId": 703, - "contract": "contracts/OffsetHelper.sol:OffsetHelper", - "label": "__gap", - "offset": 0, - "slot": "1", - "type": "t_array(t_uint256)50_storage" - }, - { - "astId": 10, + "astId": 2465, "contract": "contracts/OffsetHelper.sol:OffsetHelper", "label": "_owner", "offset": 0, - "slot": "51", + "slot": "0", "type": "t_address" }, { - "astId": 130, - "contract": "contracts/OffsetHelper.sol:OffsetHelper", - "label": "__gap", - "offset": 0, - "slot": "52", - "type": "t_array(t_uint256)49_storage" - }, - { - "astId": 3502, + "astId": 5229, "contract": "contracts/OffsetHelper.sol:OffsetHelper", "label": "eligibleSwapPaths", "offset": 0, - "slot": "101", + "slot": "1", "type": "t_mapping(t_address,t_array(t_address)dyn_storage)" }, { - "astId": 3507, + "astId": 5234, "contract": "contracts/OffsetHelper.sol:OffsetHelper", "label": "eligibleSwapPathsBySymbol", "offset": 0, - "slot": "102", + "slot": "2", "type": "t_mapping(t_string_memory_ptr,t_array(t_address)dyn_storage)" }, { - "astId": 3509, - "contract": "contracts/OffsetHelper.sol:OffsetHelper", - "label": "dexRouterAddress", - "offset": 0, - "slot": "103", - "type": "t_address" - }, - { - "astId": 3512, + "astId": 5237, "contract": "contracts/OffsetHelper.sol:OffsetHelper", "label": "poolAddresses", "offset": 0, - "slot": "104", + "slot": "3", "type": "t_array(t_address)dyn_storage" }, { - "astId": 3515, + "astId": 5240, "contract": "contracts/OffsetHelper.sol:OffsetHelper", "label": "tokenSymbolsForPaths", "offset": 0, - "slot": "105", + "slot": "4", "type": "t_array(t_string_storage)dyn_storage" }, { - "astId": 3519, + "astId": 5244, "contract": "contracts/OffsetHelper.sol:OffsetHelper", "label": "paths", "offset": 0, - "slot": "106", + "slot": "5", "type": "t_array(t_array(t_address)dyn_storage)dyn_storage" }, { - "astId": 3525, + "astId": 5246, "contract": "contracts/OffsetHelper.sol:OffsetHelper", - "label": "balances", + "label": "dexRouterAddress", "offset": 0, - "slot": "107", - "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + "slot": "6", + "type": "t_address" } ], "types": { @@ -1295,23 +1176,6 @@ "label": "string[]", "numberOfBytes": "32" }, - "t_array(t_uint256)49_storage": { - "base": "t_uint256", - "encoding": "inplace", - "label": "uint256[49]", - "numberOfBytes": "1568" - }, - "t_array(t_uint256)50_storage": { - "base": "t_uint256", - "encoding": "inplace", - "label": "uint256[50]", - "numberOfBytes": "1600" - }, - "t_bool": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - }, "t_mapping(t_address,t_array(t_address)dyn_storage)": { "encoding": "mapping", "key": "t_address", @@ -1319,20 +1183,6 @@ "numberOfBytes": "32", "value": "t_array(t_address)dyn_storage" }, - "t_mapping(t_address,t_mapping(t_address,t_uint256))": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => mapping(address => uint256))", - "numberOfBytes": "32", - "value": "t_mapping(t_address,t_uint256)" - }, - "t_mapping(t_address,t_uint256)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => uint256)", - "numberOfBytes": "32", - "value": "t_uint256" - }, "t_mapping(t_string_memory_ptr,t_array(t_address)dyn_storage)": { "encoding": "mapping", "key": "t_string_memory_ptr", @@ -1349,16 +1199,6 @@ "encoding": "bytes", "label": "string", "numberOfBytes": "32" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - }, - "t_uint8": { - "encoding": "inplace", - "label": "uint8", - "numberOfBytes": "1" } } } diff --git a/deployments/polygon/solcInputs/75278ec65526f1e0033cc879f57dc68d.json b/deployments/polygon/solcInputs/75278ec65526f1e0033cc879f57dc68d.json new file mode 100644 index 0000000..1869077 --- /dev/null +++ b/deployments/polygon/solcInputs/75278ec65526f1e0033cc879f57dc68d.json @@ -0,0 +1,125 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822ProxiableUpgradeable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeaconUpgradeable {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeaconUpgradeable.sol\";\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/StorageSlotUpgradeable.sol\";\nimport \"../utils/Initializable.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967UpgradeUpgradeable is Initializable {\n function __ERC1967Upgrade_init() internal onlyInitializing {\n }\n\n function __ERC1967Upgrade_init_unchained() internal onlyInitializing {\n }\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(AddressUpgradeable.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n _functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Emitted when the beacon is upgraded.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(AddressUpgradeable.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\n }\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return AddressUpgradeable.verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Internal function that returns the initialized version. Returns `_initialized`\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Internal function that returns the initialized version. Returns `_initializing`\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../ERC1967/ERC1967UpgradeUpgradeable.sol\";\nimport \"./Initializable.sol\";\n\n/**\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\n *\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\n * `UUPSUpgradeable` with a custom implementation of upgrades.\n *\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\n *\n * _Available since v4.1._\n */\nabstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {\n function __UUPSUpgradeable_init() internal onlyInitializing {\n }\n\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\n }\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\n address private immutable __self = address(this);\n\n /**\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\n * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\n * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\n * fail.\n */\n modifier onlyProxy() {\n require(address(this) != __self, \"Function must be called through delegatecall\");\n require(_getImplementation() == __self, \"Function must be called through active proxy\");\n _;\n }\n\n /**\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\n * callable on the implementing contract but not through proxies.\n */\n modifier notDelegated() {\n require(address(this) == __self, \"UUPSUpgradeable: must not be called through delegatecall\");\n _;\n }\n\n /**\n * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\n */\n function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\n return _IMPLEMENTATION_SLOT;\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n */\n function upgradeTo(address newImplementation) external virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\n * encoded in `data`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n */\n function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, data, true);\n }\n\n /**\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\n * {upgradeTo} and {upgradeToAndCall}.\n *\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\n *\n * ```solidity\n * function _authorizeUpgrade(address) internal override onlyOwner {}\n * ```\n */\n function _authorizeUpgrade(address newImplementation) internal virtual;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlotUpgradeable {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol": { + "content": "pragma solidity >=0.6.2;\n\ninterface IUniswapV2Router01 {\n function factory() external pure returns (address);\n function WETH() external pure returns (address);\n\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint amountADesired,\n uint amountBDesired,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline\n ) external returns (uint amountA, uint amountB, uint liquidity);\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) external payable returns (uint amountToken, uint amountETH, uint liquidity);\n function removeLiquidity(\n address tokenA,\n address tokenB,\n uint liquidity,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline\n ) external returns (uint amountA, uint amountB);\n function removeLiquidityETH(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) external returns (uint amountToken, uint amountETH);\n function removeLiquidityWithPermit(\n address tokenA,\n address tokenB,\n uint liquidity,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline,\n bool approveMax, uint8 v, bytes32 r, bytes32 s\n ) external returns (uint amountA, uint amountB);\n function removeLiquidityETHWithPermit(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline,\n bool approveMax, uint8 v, bytes32 r, bytes32 s\n ) external returns (uint amountToken, uint amountETH);\n function swapExactTokensForTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external returns (uint[] memory amounts);\n function swapTokensForExactTokens(\n uint amountOut,\n uint amountInMax,\n address[] calldata path,\n address to,\n uint deadline\n ) external returns (uint[] memory amounts);\n function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)\n external\n payable\n returns (uint[] memory amounts);\n function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)\n external\n returns (uint[] memory amounts);\n function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)\n external\n returns (uint[] memory amounts);\n function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)\n external\n payable\n returns (uint[] memory amounts);\n\n function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);\n function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);\n function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);\n function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);\n function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);\n}\n" + }, + "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol": { + "content": "pragma solidity >=0.6.2;\n\nimport './IUniswapV2Router01.sol';\n\ninterface IUniswapV2Router02 is IUniswapV2Router01 {\n function removeLiquidityETHSupportingFeeOnTransferTokens(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) external returns (uint amountETH);\n function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline,\n bool approveMax, uint8 v, bytes32 r, bytes32 s\n ) external returns (uint amountETH);\n\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external payable;\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n}\n" + }, + "contracts/interfaces/IRetirementCertificates.sol": { + "content": "// SPDX-FileCopyrightText: 2021 Toucan Labs\n//\n// SPDX-License-Identifier: UNLICENSED\n\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\n\nimport \"./IToucanContractRegistry.sol\";\n\ninterface RetirementCertificates is IERC721Upgradeable {\n /// @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n function tokenURI(uint256 tokenId) external returns (string memory);\n\n /// @notice Update retirementMessage, beneficiary, and beneficiaryString of a NFT\n /// within 24h of creation. Empty values are ignored, ie., will not overwrite the\n /// existing stored values in the NFT.\n /// @param tokenId The id of the NFT to update\n /// @param beneficiary The new beneficiary to set in the NFT\n /// @param beneficiaryString The new beneficiaryString to set in the NFT\n /// @param retirementMessage The new retirementMessage to set in the NFT\n /// @dev The function can only be called by a the NFT owner\n function updateCertificate(\n uint256 tokenId,\n address beneficiary,\n string calldata beneficiaryString,\n string calldata retirementMessage\n ) external;\n}\n" + }, + "contracts/interfaces/IToucanCarbonOffsets.sol": { + "content": "// SPDX-FileCopyrightText: 2021 Toucan Labs\n//\n// SPDX-License-Identifier: UNLICENSED\n\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\n\nimport \"../types/CarbonProjectTypes.sol\";\nimport \"../types/CarbonProjectVintageTypes.sol\";\n\ninterface IToucanCarbonOffsets is IERC20Upgradeable, IERC721Receiver {\n function getGlobalProjectVintageIdentifiers()\n external\n view\n returns (string memory, string memory);\n\n function getAttributes()\n external\n view\n returns (ProjectData memory, VintageData memory);\n\n function getRemaining() external view returns (uint256 remaining);\n\n function getDepositCap() external view returns (uint256);\n\n function retire(uint256 amount) external;\n\n function retireFrom(address account, uint256 amount) external;\n\n function mintCertificateLegacy(\n string calldata retiringEntityString,\n address beneficiary,\n string calldata beneficiaryString,\n string calldata retirementMessage,\n uint256 amount\n ) external;\n\n function retireAndMintCertificate(\n string calldata retiringEntityString,\n address beneficiary,\n string calldata beneficiaryString,\n string calldata retirementMessage,\n uint256 amount\n ) external;\n}\n" + }, + "contracts/interfaces/IToucanContractRegistry.sol": { + "content": "// SPDX-FileCopyrightText: 2021 Toucan Labs\n//\n// SPDX-License-Identifier: UNLICENSED\n\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\npragma solidity ^0.8.0;\n\ninterface IToucanContractRegistry {\n function carbonOffsetBatchesAddress() external view returns (address);\n\n function carbonProjectsAddress() external view returns (address);\n\n function carbonProjectVintagesAddress() external view returns (address);\n\n function toucanCarbonOffsetsFactoryAddress()\n external\n view\n returns (address);\n\n function carbonOffsetBadgesAddress() external view returns (address);\n\n function checkERC20(address _address) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IToucanPoolToken.sol": { + "content": "// SPDX-FileCopyrightText: 2021 Toucan Labs\n//\n// SPDX-License-Identifier: UNLICENSED\n\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\ninterface IToucanPoolToken is IERC20Upgradeable {\n function deposit(address erc20Addr, uint256 amount) external;\n\n function checkEligible(address erc20Addr) external view returns (bool);\n\n function checkAttributeMatching(address erc20Addr)\n external\n view\n returns (bool);\n\n function calculateRedeemFees(\n address[] memory tco2s,\n uint256[] memory amounts\n ) external view returns (uint256);\n\n function redeemMany(address[] memory tco2s, uint256[] memory amounts)\n external;\n\n function redeemAuto(uint256 amount) external;\n\n function redeemAuto2(uint256 amount)\n external\n returns (address[] memory tco2s, uint256[] memory amounts);\n\n function getRemaining() external view returns (uint256);\n\n function getScoredTCO2s() external view returns (address[] memory);\n}\n" + }, + "contracts/OffsetHelper.sol": { + "content": "// SPDX-FileCopyrightText: 2022 Toucan Labs\n// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\";\nimport \"./OffsetHelperStorage.sol\";\nimport \"./interfaces/IToucanPoolToken.sol\";\nimport \"./interfaces/IToucanCarbonOffsets.sol\";\nimport \"./interfaces/IToucanContractRegistry.sol\";\n\n/**\n * @title Toucan Protocol Offset Helpers\n * @notice Helper functions that simplify the carbon offsetting (retirement)\n * process.\n *\n * Retiring carbon tokens requires multiple steps and interactions with\n * Toucan Protocol's main contracts:\n * 1. Obtain a pool token e.g., NCT (by performing a token\n * swap on a DEX).\n * 2. Redeem the pool token for a TCO2 token.\n * 3. Retire the TCO2 token.\n *\n * These steps are combined in each of the following \"auto offset\" methods\n * implemented in `OffsetHelper` to allow a retirement within one transaction:\n * - `autoOffsetPoolToken()` if the user already owns a Toucan pool\n * token e.g., NCT,\n * - `autoOffsetExactOutETH()` if the user would like to perform a retirement\n * using native tokens e.g., MATIC, specifying the exact amount of TCO2s to retire (only on Polygon, not on Celo),\n * - `autoOffsetExactInETH()` if the user would like to perform a retirement\n * using native tokens, swapping all sent native tokens into TCO2s (only on Polygon, not on Celo),\n * - `autoOffsetExactOutToken()` if the user would like to perform a retirement\n * using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount\n * of TCO2s to retire,\n * - `autoOffsetExactInToken()` if the user would like to perform a retirement\n * using an ERC20 token (cUSD, USDC, WETH or WMATIC), specifying the exact amount\n * of token to swap into TCO2s.\n *\n * In these methods, \"auto\" refers to the fact that these methods use\n * `autoRedeem()` in order to automatically choose a TCO2 token corresponding\n * to the oldest tokenized carbon project in the specfified token pool.\n * There are no fees incurred by the user when using `autoRedeem()`, i.e., the\n * user receives 1 TCO2 token for each pool token (BCT/NCT) redeemed.\n *\n * There are two `view` helper functions `calculateNeededETHAmount()` and\n * `calculateNeededTokenAmount()` that should be called before using\n * `autoOffsetExactOutETH()` and `autoOffsetExactOutToken()`, to determine how\n * much native tokens e.g., MATIC, respectively how much of the ERC20 token must be sent to the\n * `OffsetHelper` contract in order to retire the specified amount of carbon.\n *\n * The two `view` helper functions `calculateExpectedPoolTokenForETH()` and\n * `calculateExpectedPoolTokenForToken()` can be used to calculate the\n * expected amount of TCO2s that will be offset using functions\n * `autoOffsetExactInETH()` and `autoOffsetExactInToken()`.\n */\ncontract OffsetHelper is OffsetHelperStorage {\n using SafeERC20 for IERC20;\n // As Celo allows to pay the gas fees with other tokens than the native token,\n // it's not possible ot use the swapETH (swap native tokens) functions.\n uint256 private constant CELO_MAINNET_CHAINID = 42220;\n uint256 private constant ALFAJORES_MAINNET_CHAINID = 44787;\n\n /**\n * @notice Emitted upon successful redemption of TCO2 tokens from a Toucan\n * pool token e.g., NCT.\n *\n * @param sender The sender of the transaction\n * @param poolToken The address of the pool token used in the\n * redemption, e.g., NCT\n * @param tco2s An array of the TCO2 addresses that were redeemed\n * @param amounts An array of the amounts of each TCO2 that were redeemed\n */\n event Redeemed(\n address sender,\n address poolToken,\n address[] tco2s,\n uint256[] amounts\n );\n\n modifier onlyRedeemable(address _token) {\n require(isRedeemable(_token), \"Token not redeemable.\");\n\n _;\n }\n\n modifier onlySwappable(address _token) {\n require(isSwappable(_token), \"Path doesn't yet exist.\");\n\n _;\n }\n\n modifier isNotCelo() {\n require(\n block.chainid != CELO_MAINNET_CHAINID &&\n block.chainid != ALFAJORES_MAINNET_CHAINID,\n \"The function is not available on Celo.\"\n );\n\n _;\n }\n\n /**\n * @notice Contract constructor. Should specify arrays of ERC20 symbols and\n * addresses that can used by the contract.\n *\n * @dev See `isEligible()` for a list of tokens that can be used in the\n * contract. These can be modified after deployment by the contract owner\n * using `setEligibleTokenAddress()` and `deleteEligibleTokenAddress()`.\n *\n * @param _poolAddresses A list of pool token addresses.\n * @param _tokenSymbolsForPaths An array of symbols of the token the user want to retire carbon credits for\n * @param _paths An array of arrays of addresses to describe the path needed to swap form the baseToken to the pool Token\n * to the provided token symbols.\n */\n constructor(\n address[] memory _poolAddresses,\n string[] memory _tokenSymbolsForPaths,\n address[][] memory _paths,\n address _dexRouterAddress\n ) {\n poolAddresses = _poolAddresses;\n tokenSymbolsForPaths = _tokenSymbolsForPaths;\n paths = _paths;\n dexRouterAddress = _dexRouterAddress;\n\n uint256 eligibleSwapPathsBySymbolLen = _tokenSymbolsForPaths.length;\n for (uint256 i; i < eligibleSwapPathsBySymbolLen; i++) {\n eligibleSwapPaths[_paths[i][0]] = _paths[i];\n eligibleSwapPathsBySymbol[_tokenSymbolsForPaths[i]] = _paths[i];\n }\n }\n\n // The receive and fallback method are needed to fix the situation where transfering dust native tokens\n // in the native tokens to token swap fails\n receive() external payable {}\n\n // ----------------------------------------\n // Public functions\n // ----------------------------------------\n\n /**\n * @notice Retire carbon credits using the oldest TCO2\n * tokens available from the specified Toucan token pool by sending ERC20\n * tokens (cUSD, USDC, WETH, WMATIC). Use `calculateNeededTokenAmount` first in\n * order to find out how much of the ERC20 token is required to retire the\n * specified quantity of TCO2.\n *\n * This function:\n * 1. Swaps the ERC20 token sent to the contract for the specified pool token.\n * 2. Redeems the pool token for the oldest TCO2 tokens available.\n * 3. Retires the TCO2 tokens.\n *\n * Note: The client must approve the ERC20 token that is sent to the contract.\n *\n * @dev When automatically redeeming pool tokens for the oldest ones\n * TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool\n * token.\n *\n * @param _fromToken The address of the ERC20 token that the user sends\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\n * @param _poolToken The address of the pool token that the\n * user wants to use, e.g., NCT\n * @param _amountToOffset The amount of TCO2 to offset\n *\n * @return tco2s An array of the TCO2 addresses that were redeemed\n * @return amounts An array of the amounts of each TCO2 that were redeemed\n */\n function autoOffsetExactOutToken(\n address _fromToken,\n address _poolToken,\n uint256 _amountToOffset\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\n // swap input token for BCT / NCT\n swapExactOutToken(_fromToken, _poolToken, _amountToOffset);\n\n // redeem BCT / NCT for TCO2s\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\n\n // retire the TCO2s to achieve offset\n autoRetire(tco2s, amounts);\n }\n\n /**\n * @notice Retire carbon credits using the oldest TCO2\n * tokens available from the specified Toucan token pool by sending ERC20\n * tokens (cUSD, USDC, WETH, WMATIC). All provided token is consumed for\n * offsetting. Use `calculateExpectedPoolTokenForToken()` to calculate the expected amount\n * of Pool token that can be acquired by swapping the provided amount of ERC20 token.\n *\n * This function:\n * 1. Swaps the ERC20 token sent to the contract for the specified pool token.\n * 2. Redeems the pool token for the oldest TCO2 tokens available.\n * 3. Retires the TCO2 tokens.\n *\n * Note: The client must approve the ERC20 token that is sent to the contract.\n *\n * @dev When automatically redeeming pool tokens for the oldest ones\n * TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool\n * token.\n *\n * @param _fromToken The address of the ERC20 token that the user sends\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\n * @param _poolToken The address of the pool token that the\n * user wants to use, e.g., NCT\n * @param _amountToSwap The amount of ERC20 token to swap into Toucan pool\n * token. Full amount will be used for offsetting.\n *\n * @return tco2s An array of the TCO2 addresses that were redeemed\n * @return amounts An array of the amounts of each TCO2 that were redeemed\n */\n function autoOffsetExactInToken(\n address _fromToken,\n address _poolToken,\n uint256 _amountToSwap\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\n // swap input token for BCT / NCT\n uint256 amountToOffset = swapExactInToken(\n _fromToken,\n _poolToken,\n _amountToSwap\n );\n\n // redeem BCT / NCT for TCO2s\n (tco2s, amounts) = autoRedeem(_poolToken, amountToOffset);\n\n // retire the TCO2s to achieve offset\n autoRetire(tco2s, amounts);\n }\n\n /**\n * @notice Retire carbon credits using the oldest TCO2\n * tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC.\n * Use `calculateNeededETHAmount()` first in order to find out how much\n * native tokens are required to retire the specified quantity of TCO2.\n *\n * This function:\n * 1. Swaps the Matic sent to the contract for the specified pool token.\n * 2. Redeems the pool token for the oldest TCO2 tokens available.\n * 3. Retires the TCO2 tokens.\n *\n * @dev If the user sends too much native tokens , the leftover amount will be sent back\n * to the user. This function is only available on Polygon, not on Celo.\n *\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n * @param _amountToOffset The amount of TCO2 to offset.\n *\n * @return tco2s An array of the TCO2 addresses that were redeemed\n * @return amounts An array of the amounts of each TCO2 that were redeemed\n */\n function autoOffsetExactOutETH(\n address _poolToken,\n uint256 _amountToOffset\n )\n public\n payable\n isNotCelo\n returns (address[] memory tco2s, uint256[] memory amounts)\n {\n // swap native tokens for BCT / NCT\n swapExactOutETH(_poolToken, _amountToOffset);\n\n // redeem BCT / NCT for TCO2s\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\n\n // retire the TCO2s to achieve offset\n autoRetire(tco2s, amounts);\n }\n\n /**\n * @notice Retire carbon credits using the oldest TCO2\n * tokens available from the specified Toucan token pool by sending native tokens e.g., MATIC.\n * All provided native tokens is consumed for offsetting.\n * Use `calculateExpectedPoolTokenForETH()` to calculate the expected amount of\n * Pool token that can be acquired by swapping the provided amount of native tokens e.g., MATIC.\n *\n * This function:\n * 1. Swaps the Matic sent to the contract for the specified pool token.\n * 2. Redeems the pool token for the oldest TCO2 tokens available.\n * 3. Retires the TCO2 tokens.\n *\n * @dev This function is only available on Polygon, not on Celo.\n *\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n *\n * @return tco2s An array of the TCO2 addresses that were redeemed\n * @return amounts An array of the amounts of each TCO2 that were redeemed\n */\n function autoOffsetExactInETH(\n address _poolToken\n )\n public\n payable\n isNotCelo\n returns (address[] memory tco2s, uint256[] memory amounts)\n {\n // swap native tokens for BCT / NCT\n uint256 amountToOffset = swapExactInETH(_poolToken);\n\n // redeem BCT / NCT for TCO2s\n (tco2s, amounts) = autoRedeem(_poolToken, amountToOffset);\n\n // retire the TCO2s to achieve offset\n autoRetire(tco2s, amounts);\n }\n\n /**\n * @notice Retire carbon credits using the oldest TCO2\n * tokens available by sending pool tokens, e.g., NCT.\n *\n * This function:\n * 1. Redeems the pool token for the oldest TCO2 tokens available.\n * 2. Retires the TCO2 tokens.\n *\n * Note: The client must approve the pool token that is sent.\n *\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n * @param _amountToOffset The amount of TCO2 to offset.\n *\n * @return tco2s An array of the TCO2 addresses that were redeemed\n * @return amounts An array of the amounts of each TCO2 that were redeemed\n */\n function autoOffsetPoolToken(\n address _poolToken,\n uint256 _amountToOffset\n ) public returns (address[] memory tco2s, uint256[] memory amounts) {\n // deposit pool token from user to this contract\n IERC20(_poolToken).safeTransferFrom(\n msg.sender,\n address(this),\n _amountToOffset\n );\n\n // redeem BCT / NCT for TCO2s\n (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);\n\n // retire the TCO2s to achieve offset\n autoRetire(tco2s, amounts);\n }\n\n /**\n * @notice Redeems the specified amount of NCT / BCT for TCO2.\n * @dev Needs to be approved on the client side\n * @param _fromToken Could be the address of NCT\n * @param _amount Amount to redeem\n * @return tco2s An array of the TCO2 addresses that were redeemed\n * @return amounts An array of the amounts of each TCO2 that were redeemed\n */\n function autoRedeem(\n address _fromToken,\n uint256 _amount\n )\n public\n onlyRedeemable(_fromToken)\n returns (address[] memory tco2s, uint256[] memory amounts)\n {\n require(\n IERC20(_fromToken).balanceOf(address(this)) >= _amount,\n \"Insufficient NCT/BCT balance\"\n );\n\n // instantiate pool token (NCT)\n IToucanPoolToken PoolTokenImplementation = IToucanPoolToken(_fromToken);\n\n // auto redeem pool token for TCO2; will transfer automatically picked TCO2 to this contract\n (tco2s, amounts) = PoolTokenImplementation.redeemAuto2(_amount);\n\n emit Redeemed(msg.sender, _fromToken, tco2s, amounts);\n }\n\n /**\n * @notice Retire the specified TCO2 tokens.\n * @param _tco2s The addresses of the TCO2s to retire\n * @param _amounts The amounts to retire from each of the corresponding\n * TCO2 addresses\n */\n function autoRetire(\n address[] memory _tco2s,\n uint256[] memory _amounts\n ) public {\n uint256 tco2sLen = _tco2s.length;\n require(tco2sLen != 0, \"Array empty\");\n\n require(tco2sLen == _amounts.length, \"Arrays unequal\");\n\n for (uint i = 0; i < tco2sLen; i++) {\n if (_amounts[i] == 0) {\n continue;\n }\n require(\n IERC20(_tco2s[i]).balanceOf(address(this)) >= _amounts[i],\n \"Insufficient TCO2 balance\"\n );\n\n IToucanCarbonOffsets(_tco2s[i]).retire(_amounts[i]);\n }\n }\n\n /**\n * @notice Swap eligible ERC20 tokens for pool tokens (BCT/NCT) on SushiSwap\n * @dev Needs to be approved on the client side\n * @param _fromToken The address of the ERC20 token used for the swap\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n * @param _toAmount The required amount of the pool token (NCT/BCT)\n */\n function swapExactOutToken(\n address _fromToken,\n address _poolToken,\n uint256 _toAmount\n ) public onlySwappable(_fromToken) onlyRedeemable(_poolToken) {\n // calculate path & amounts\n (\n address[] memory path,\n uint256[] memory expAmounts\n ) = calculateExactOutSwap(_fromToken, _poolToken, _toAmount);\n uint256 amountIn = expAmounts[0];\n\n // transfer tokens\n IERC20(_fromToken).safeTransferFrom(\n msg.sender,\n address(this),\n amountIn\n );\n\n // approve router\n IERC20(_fromToken).approve(dexRouterAddress, amountIn);\n\n // swap\n uint256[] memory amounts = dexRouter().swapTokensForExactTokens(\n _toAmount,\n amountIn, // max. input amount\n path,\n address(this),\n block.timestamp\n );\n\n // remove remaining approval if less input token was consumed\n if (amounts[0] < amountIn) {\n IERC20(_fromToken).approve(dexRouterAddress, 0);\n }\n }\n\n /**\n * @notice Swap eligible ERC20 tokens for pool tokens (BCT/NCT) on\n * SushiSwap. All provided ERC20 tokens will be swapped.\n * @dev Needs to be approved on the client side.\n * @param _fromToken The address of the ERC20 token used for the swap\n * @param _poolToken The address of the pool token to swap for,\n * @param _fromAmount The amount of ERC20 token to swap\n * e.g., NCT\n * @return amountOut Resulting amount of pool token that got acquired for the\n * swapped ERC20 tokens.\n */\n function swapExactInToken(\n address _fromToken,\n address _poolToken,\n uint256 _fromAmount\n )\n public\n onlySwappable(_fromToken)\n onlyRedeemable(_poolToken)\n returns (uint256 amountOut)\n {\n // calculate path & amounts\n address[] memory path = generatePath(_fromToken, _poolToken);\n\n uint256 len = path.length;\n\n // transfer tokens\n IERC20(_fromToken).safeTransferFrom(\n msg.sender,\n address(this),\n _fromAmount\n );\n\n // approve router\n IERC20(_fromToken).safeApprove(dexRouterAddress, _fromAmount);\n\n // swap\n uint256[] memory amounts = dexRouter().swapExactTokensForTokens(\n _fromAmount,\n 0, // min. output amount\n path,\n address(this),\n block.timestamp\n );\n amountOut = amounts[len - 1];\n }\n\n /**\n * @notice Swap native tokens e.g., MATIC for pool tokens (BCT/NCT) on SushiSwap.\n * Remaining native tokens that was not consumed by the swap is returned.\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n * @param _toAmount The required amount of the pool token (NCT/BCT)\n */\n function swapExactOutETH(\n address _poolToken,\n uint256 _toAmount\n ) public payable isNotCelo onlyRedeemable(_poolToken) {\n // create path & amounts\n // wrap the native token\n address fromToken = eligibleSwapPathsBySymbol[\"WMATIC\"][0];\n address[] memory path = generatePath(fromToken, _poolToken);\n\n // swap\n uint256[] memory amounts = dexRouter().swapETHForExactTokens{\n value: msg.value\n }(_toAmount, path, address(this), block.timestamp);\n\n // send surplus back\n if (msg.value > amounts[0]) {\n uint256 leftoverETH = msg.value - amounts[0];\n (bool success, ) = msg.sender.call{value: leftoverETH}(\n new bytes(0)\n );\n\n require(success, \"Failed to send surplus back\");\n }\n }\n\n /**\n * @notice Swap native tokens e.g., MATIC for pool tokens (BCT/NCT) on SushiSwap. All\n * provided native tokens will be swapped.\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n * @return amountOut Resulting amount of pool token that got acquired for the\n * swapped native tokens .\n */\n function swapExactInETH(\n address _poolToken\n )\n public\n payable\n isNotCelo\n onlyRedeemable(_poolToken)\n returns (uint256 amountOut)\n {\n // create path & amounts\n uint256 fromAmount = msg.value;\n // wrap the native token\n address fromToken = eligibleSwapPathsBySymbol[\"WMATIC\"][0];\n address[] memory path = generatePath(fromToken, _poolToken);\n\n uint256 len = path.length;\n\n // swap\n uint256[] memory amounts = dexRouter().swapExactETHForTokens{\n value: fromAmount\n }(0, path, address(this), block.timestamp);\n amountOut = amounts[len - 1];\n }\n\n // ----------------------------------------\n // Public view functions\n // ----------------------------------------\n\n /**\n * @notice Return how much of the specified ERC20 token is required in\n * order to swap for the desired amount of a pool token, for\n * example, e.g., NCT.\n *\n * @param _fromToken The address of the ERC20 token used for the swap\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n * @param _toAmount The desired amount of pool token to receive\n * @return amountIn The amount of the ERC20 token required in order to\n * swap for the specified amount of the pool token\n */\n function calculateNeededTokenAmount(\n address _fromToken,\n address _poolToken,\n uint256 _toAmount\n )\n public\n view\n onlySwappable(_fromToken)\n onlyRedeemable(_poolToken)\n returns (uint256 amountIn)\n {\n (, uint256[] memory amounts) = calculateExactOutSwap(\n _fromToken,\n _poolToken,\n _toAmount\n );\n amountIn = amounts[0];\n }\n\n /**\n * @notice Return how much native tokens e.g, MATIC is required in order to swap for the\n * desired amount of a pool token, e.g., NCT.\n * @param _poolToken The address of the pool token to swap for, for\n * example, NCT\n * @param _toAmount The desired amount of pool token to receive\n * @return amountIn The amount of native tokens required in order to swap for\n * the specified amount of the pool token\n */\n function calculateNeededETHAmount(\n address _poolToken,\n uint256 _toAmount\n ) public view onlyRedeemable(_poolToken) returns (uint256 amountIn) {\n address fromToken = eligibleSwapPathsBySymbol[\"WMATIC\"][0];\n (, uint256[] memory amounts) = calculateExactOutSwap(\n fromToken,\n _poolToken,\n _toAmount\n );\n amountIn = amounts[0];\n }\n\n /**\n * @notice Calculates the expected amount of pool token that can be\n * acquired by swapping the provided amount of ERC20 token.\n *\n * @param _fromToken The address of the ERC20 token used for the swap\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n * @param _fromAmount The amount of ERC20 token to swap\n * @return amountOut The expected amount of Pool token that can be acquired\n */\n function calculateExpectedPoolTokenForToken(\n address _fromToken,\n address _poolToken,\n uint256 _fromAmount\n )\n public\n view\n onlySwappable(_fromToken)\n onlyRedeemable(_poolToken)\n returns (uint256 amountOut)\n {\n (, uint256[] memory amounts) = calculateExactInSwap(\n _fromToken,\n _poolToken,\n _fromAmount\n );\n amountOut = amounts[amounts.length - 1];\n }\n\n /**\n * @notice Calculates the expected amount of pool token that can be\n * acquired by swapping the provided amount of native tokens e.g., MATIC.\n *\n * @param _fromTokenAmount The amount of native tokens to swap\n * @param _poolToken The address of the pool token to swap for,\n * e.g., NCT\n * @return amountOut The expected amount of Pool token that can be acquired\n */\n function calculateExpectedPoolTokenForETH(\n address _poolToken,\n uint256 _fromTokenAmount\n )\n public\n view\n isNotCelo\n onlyRedeemable(_poolToken)\n returns (uint256 amountOut)\n {\n address fromToken = eligibleSwapPathsBySymbol[\"WMATIC\"][0];\n (, uint256[] memory amounts) = calculateExactInSwap(\n fromToken,\n _poolToken,\n _fromTokenAmount\n );\n amountOut = amounts[amounts.length - 1];\n }\n\n // ----------------------------------------\n // Internal functions\n // ----------------------------------------\n\n function calculateExactOutSwap(\n address _fromToken,\n address _poolToken,\n uint256 _toAmount\n ) internal view returns (address[] memory path, uint256[] memory amounts) {\n // create path & calculate amounts\n path = generatePath(_fromToken, _poolToken);\n uint256 len = path.length;\n\n amounts = dexRouter().getAmountsIn(_toAmount, path);\n\n // sanity check arrays\n require(len == amounts.length, \"Arrays unequal\");\n require(_toAmount == amounts[len - 1], \"Output amount mismatch\");\n }\n\n function calculateExactInSwap(\n address _fromToken,\n address _poolToken,\n uint256 _fromAmount\n ) internal view returns (address[] memory path, uint256[] memory amounts) {\n // create path & calculate amounts\n path = generatePath(_fromToken, _poolToken);\n uint256 len = path.length;\n\n amounts = dexRouter().getAmountsOut(_fromAmount, path);\n\n // sanity check arrays\n require(len == amounts.length, \"Arrays unequal\");\n require(_fromAmount == amounts[0], \"Input amount mismatch\");\n }\n\n /**\n * @notice Show all pool token addresses that can be used to retired.\n * @param _fromToken a list of token symbols that can be retired.\n * @param _toToken a list of token symbols that can be retired.\n */\n function generatePath(\n address _fromToken,\n address _toToken\n ) internal view returns (address[] memory path) {\n uint256 len = eligibleSwapPaths[_fromToken].length;\n if (len == 1) {\n path = new address[](2);\n path[0] = _fromToken;\n path[1] = _toToken;\n return path;\n }\n if (len == 2) {\n path = new address[](3);\n path[0] = _fromToken;\n path[1] = eligibleSwapPaths[_fromToken][1];\n path[2] = _toToken;\n return path;\n }\n if (len == 3) {\n path = new address[](3);\n path[0] = _fromToken;\n path[1] = eligibleSwapPaths[_fromToken][1];\n path[2] = eligibleSwapPaths[_fromToken][2];\n path[3] = _toToken;\n return path;\n } else {\n path = new address[](4);\n path[0] = _fromToken;\n path[1] = eligibleSwapPaths[_fromToken][1];\n path[2] = eligibleSwapPaths[_fromToken][2];\n path[3] = eligibleSwapPaths[_fromToken][3];\n path[4] = _toToken;\n return path;\n }\n }\n\n function dexRouter() internal view returns (IUniswapV2Router02) {\n return IUniswapV2Router02(dexRouterAddress);\n }\n\n // ----------------------------------------\n // Private functions\n // ----------------------------------------\n\n /**\n * @notice Checks whether an address is a pool token address\n * @param _erc20Address address of token to be checked\n * @return True if the address is a pool token address\n */\n function isRedeemable(address _erc20Address) private view returns (bool) {\n for (uint i = 0; i < poolAddresses.length; i++) {\n if (poolAddresses[i] == _erc20Address) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * @notice Checks whether an address can be used in a token swap\n * @param _erc20Address address of token to be checked\n * @return True if the specified address can be used in a swap\n */\n function isSwappable(address _erc20Address) private view returns (bool) {\n for (uint i = 0; i < paths.length; i++) {\n if (paths[i][0] == _erc20Address) {\n return true;\n }\n }\n\n return false;\n }\n\n // ----------------------------------------\n // Admin methods\n // ----------------------------------------\n\n /**\n * @notice Checks if ERC20 Token is eligible for Offsetting.\n * @param _erc20Address The address of the ERC20 token that the user sends\n * (e.g., cUSD, cUSD, USDC, WETH, WMATIC)\n * @return _path Returns the path of the token to be exchanged\n */\n\n function isERC20AddressEligible(\n address _erc20Address\n ) public view returns (address[] memory _path) {\n _path = eligibleSwapPaths[_erc20Address];\n }\n\n /**\n * @notice Change or add eligible paths and their addresses.\n * @param _tokenSymbol The symbol of the token to add\n * @param _path The path of the path to add\n */\n function addPath(\n string memory _tokenSymbol,\n address[] memory _path\n ) public virtual onlyOwner {\n eligibleSwapPaths[_path[0]] = _path;\n eligibleSwapPathsBySymbol[_tokenSymbol] = _path;\n tokenSymbolsForPaths.push(_tokenSymbol);\n }\n\n /**\n * @notice Delete eligible tokens stored in the contract.\n * @param _tokenSymbol The symbol of the path to remove\n */\n function removePath(string memory _tokenSymbol) public virtual onlyOwner {\n delete eligibleSwapPaths[eligibleSwapPathsBySymbol[_tokenSymbol][0]];\n delete eligibleSwapPathsBySymbol[_tokenSymbol];\n }\n\n /**\n * @notice Cheks if Pool Token is eligible for Offsetting.\n * @param _poolToken The addresses of the pool token to redeem\n * @return _isEligible Returns if token can be redeemed\n */\n\n function isPoolAddressEligible(\n address _poolToken\n ) public view returns (bool _isEligible) {\n _isEligible = isRedeemable(_poolToken);\n }\n\n /**\n * @notice Change or add pool token addresses.\n * @param _poolToken The address of the pool token to add\n */\n function addPoolToken(address _poolToken) public virtual onlyOwner {\n poolAddresses.push(_poolToken);\n }\n\n /**\n * @notice Delete eligible pool token addresses stored in the contract.\n * @param _poolToken The address of the pool token to remove\n */\n function removePoolToken(address _poolToken) public virtual onlyOwner {\n for (uint256 i; i < poolAddresses.length; i++) {\n if (poolAddresses[i] == _poolToken) {\n poolAddresses[i] = poolAddresses[poolAddresses.length - 1];\n poolAddresses.pop();\n break;\n }\n }\n }\n}\n" + }, + "contracts/OffsetHelperStorage.sol": { + "content": "// SPDX-FileCopyrightText: 2022 Toucan Labs\n//\n// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract OffsetHelperStorage is Ownable {\n // token symbol => token address\n mapping(address => address[]) public eligibleSwapPaths;\n mapping(string => address[]) public eligibleSwapPathsBySymbol;\n\n address[] public poolAddresses;\n string[] public tokenSymbolsForPaths;\n address[][] public paths;\n address public dexRouterAddress;\n}\n" + }, + "contracts/types/CarbonProjectTypes.sol": { + "content": "// SPDX-FileCopyrightText: 2021 Toucan Labs\n//\n// SPDX-License-Identifier: UNLICENSED\n\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\n\npragma solidity >=0.8.4 <0.9.0;\n\n/// @dev CarbonProject related data and attributes\nstruct ProjectData {\n string projectId;\n string standard;\n string methodology;\n string region;\n string storageMethod;\n string method;\n string emissionType;\n string category;\n string uri;\n address controller;\n}\n" + }, + "contracts/types/CarbonProjectVintageTypes.sol": { + "content": "// SPDX-FileCopyrightText: 2021 Toucan Labs\n//\n// SPDX-License-Identifier: UNLICENSED\n\n// If you encounter a vulnerability or an issue, please contact or visit security.toucan.earth\n\npragma solidity >=0.8.4 <0.9.0;\n\nstruct VintageData {\n /// @dev A human-readable string which differentiates this from other vintages in\n /// the same project, and helps build the corresponding TCO2 name and symbol.\n string name;\n uint64 startTime; // UNIX timestamp\n uint64 endTime; // UNIX timestamp\n uint256 projectTokenId;\n uint64 totalVintageQuantity;\n bool isCorsiaCompliant;\n bool isCCPcompliant;\n string coBenefits;\n string correspAdjustment;\n string additionalCertification;\n string uri;\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file