Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Update deployment scripts for multiple chains #184

Open
wants to merge 99 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
0b3ed1e
update test lib with smart contract verification on evm-based networks
Nov 14, 2022
dd6cd9e
remove deploy comment which will appear before all unit tests
Nov 14, 2022
06c1704
fix addressZero bug
Nov 14, 2022
9cbd429
remove sleep and buildContext from eTestLib exports
Nov 14, 2022
eaf1b07
fix pull request comments
Nov 22, 2022
9f1715b
update deploy lib
Nov 24, 2022
1be664d
Merge branch 'master' into deploy-lib
tarieuler Nov 25, 2022
98d7bd4
uniswap logic carved out to a library
kasperpawlowski Aug 23, 2022
749ab27
permissioned market activation with chainlink
kasperpawlowski Nov 26, 2022
eaab561
tests for permissioned market activation
kasperpawlowski Nov 26, 2022
4cc3066
resolve merge conflict with master branch in test/lib/eTestLib.js
Nov 28, 2022
217c115
modify test chainlink oracle and add test token faucet source code
Nov 29, 2022
ca275ba
add goerli testERC20TokenFaucet address
Nov 29, 2022
481f1d0
Merge branch 'master' into deploy-lib
Dec 8, 2022
80b45ee
update hardhat config for zksync testnet support
Dec 9, 2022
1239d20
update gitignore file to ignore zksync generated folders
Dec 9, 2022
4afb5e7
update hardhat config and test zksync script
Dec 12, 2022
4058265
add zksync hardhat tasks
Dec 12, 2022
43961d8
update hardhat task for zksync
Dec 12, 2022
4278652
update hardhat task for transfer zksync
Dec 12, 2022
013b7cc
update zksync deployment script
Dec 14, 2022
e071f9b
zksync deployment script
Dec 20, 2022
290d6fa
update deploy lib
Dec 20, 2022
ea38523
fix proxies in zksync deploy script
Dec 20, 2022
ecd85f4
update zksyc hardhat task with testnet flag
Jan 3, 2023
5f27907
update gitignore file
Jan 3, 2023
8106b60
update zk deploy
Jan 6, 2023
21d1368
update hardhat etherscan apiKey configuration for multiple networks
Jan 6, 2023
84a7c64
update gitignore file
Jan 6, 2023
df4f1bd
add support for bsc smart contract verification
tarieuler Jan 6, 2023
61a09c3
update bsc configs
tarieuler Jan 6, 2023
3122b33
Merge branch 'master' into bsc-deployment
tarieuler Jan 9, 2023
0ce8ec1
Merge remote-tracking branch 'origin/risk-manager-update' into bsc-no…
tarieuler Jan 11, 2023
426cc96
Merge remote-tracking branch 'origin/permissioned-market-activation' …
tarieuler Jan 11, 2023
e3ed57d
update test lib
tarieuler Jan 25, 2023
9c97796
Merge branch 'mock-chainlink-oracle' into bsc-no-univ3
tarieuler Jan 25, 2023
7b41fe7
add testERC20TokenFaucet deployment to etestlib
tarieuler Jan 25, 2023
5eeeafe
update hardhat config
tarieuler Jan 26, 2023
71c2eed
update testlib
tarieuler Jan 26, 2023
1b49e81
update deploy lib
tarieuler Jan 26, 2023
d5bddfe
fix verification issues
tarieuler Jan 26, 2023
df2a4fd
add optimism goerli deployment input file
tarieuler Jan 26, 2023
987f451
update optimism goerli input file
tarieuler Jan 26, 2023
327a2a3
add optimism smart contract addresses
tarieuler Jan 26, 2023
6c4b84f
update test token hardhat tasks
tarieuler Jan 26, 2023
c0336ec
update deploy test tokens in secure mode
tarieuler Jan 26, 2023
eccc237
update testlib
tarieuler Jan 26, 2023
5348ac1
update token list
tarieuler Jan 27, 2023
02523ea
update token list
tarieuler Jan 27, 2023
9d101b0
feat: decode simulation with a delegate call
rori4 Jan 30, 2023
2e175d3
refactor: :fire: remove hardhat console sol
rori4 Jan 31, 2023
b3c37fa
fix: expect proper error selector and require fail
rori4 Jan 31, 2023
b456b59
test: malicious token test for simulation
rori4 Jan 31, 2023
eee5f15
update deployment scripts
tarieuler Feb 6, 2023
d1c9262
Merge branch 'deploy-lib' of https://github.com/euler-xyz/euler-contr…
tarieuler Feb 6, 2023
a74f96f
update deployLib.js
tarieuler Feb 6, 2023
49c248a
rm tasks/zkSync.js
tarieuler Feb 6, 2023
4b61d3d
rm zksync scripts
tarieuler Feb 6, 2023
2411a83
rename deploy input script
tarieuler Feb 6, 2023
b36aaa2
look for uniswap pool only if uniswap factory defined
kasperpawlowski Feb 8, 2023
f38a961
update etestlib for Deployment without Uniswap (Factory)
tarieuler Feb 9, 2023
6f5a737
fix deploy lib for risk manager no uniswap
tarieuler Feb 9, 2023
50196a1
add tests for risk manager with undefined uniswap factory
kasperpawlowski Feb 9, 2023
7265de6
merge permissioned-market-activation into deploy-lib
tarieuler Feb 10, 2023
e8f4a83
upgrade risk manager without uniswap using zero factory address and z…
tarieuler Feb 10, 2023
da899fe
add new risk manager address for optimism goerli
tarieuler Feb 10, 2023
3ad2966
remove comment block from etestlib
tarieuler Feb 10, 2023
3f9c8c2
add hardhat task for testtoken:deployChainlinkOracle
tarieuler Feb 10, 2023
0cec24b
rename hardhat task testtoken:deployChainlinkOracle to testtoken:depl…
tarieuler Feb 10, 2023
834bc60
add zksync deployment script with contract verification output, hardh…
tarieuler Feb 14, 2023
0ac1cbe
install required dependencies for zksync deployment
tarieuler Feb 14, 2023
5a0fae1
update zksolc compiler version to latest
tarieuler Feb 15, 2023
1b7196c
add working zk sync deployment script
tarieuler Feb 15, 2023
649af7a
Fix: getPriceFull forwarded pricing type
hoytech Feb 16, 2023
7ed7598
Bugfix in test
hoytech Feb 16, 2023
cce7339
add oracle addresses
tarieuler Feb 21, 2023
3c8a031
update etestlib token faucet verification object
tarieuler Feb 21, 2023
bd2d885
update bsc testnet addresses
tarieuler Feb 21, 2023
b51d1f3
add hardhat task to update mock chainlink oracle owner
tarieuler Feb 21, 2023
b7f7512
add hardhat task for zksync testnetChainlinkOracleChangeOwner
tarieuler Feb 21, 2023
d7bd58f
update binance testnet risk manager module with address(1) as referen…
tarieuler Feb 24, 2023
d1fdce3
update WETH market with chainlink oracle on binance testnet
tarieuler Feb 24, 2023
1fe9e5f
add base testnet contract addresses
tarieuler Feb 24, 2023
c14f29f
fix linting
tarieuler Feb 24, 2023
2b4ea99
USD reference asset
kasperpawlowski Feb 24, 2023
d7d2117
fix: ECE-01S and ECE-01C
kasperpawlowski Mar 6, 2023
775ce2a
add delta balances smart contract and update deployment scripts
tarieuler Mar 9, 2023
689ee8d
deploy and verify delta balances
tarieuler Mar 9, 2023
c919777
add comp and wbtc markets to base and bsc testnets
tarieuler Mar 10, 2023
d4602cc
Merge branch 'feature/new-batch-dispatch-simulate' into deploy-lib
tarieuler Mar 10, 2023
a0836c7
update exec module on bsc testnet
tarieuler Mar 10, 2023
55d61a9
update exec module on base testnet
tarieuler Mar 10, 2023
5b076b6
Merge branch 'risk-manager-reference-asset-update' into deploy-lib
tarieuler Mar 10, 2023
c78c373
upgrade risk manager on base and bsc testnet
tarieuler Mar 10, 2023
2a83fc6
update etestlib
tarieuler Mar 10, 2023
42bfab7
update deployment input file
tarieuler Mar 10, 2023
34f86ef
update etestlib
tarieuler Mar 10, 2023
6038e21
update addresses for base testnet
tarieuler Mar 10, 2023
a9285c2
update zk deployment script
tarieuler Mar 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
/euler-addresses.json
/euler-addresses-*.json
/euler-contracts-verification-*.json
/node_modules/
/artifacts/
/cache/
/artifacts-zk/
/cache-zk/
/.idea/
/coverage.json
/coverage/
Expand Down
58 changes: 58 additions & 0 deletions addresses/euler-addresses-basetestnet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"tokens": {
"EUL": "0x6ad40cE1C9D3A518dCE8D89295008ECA1bf0F321",
"WETH": "0xE392Ee380A9917D08B521E9488a66C83364678d2",
"USDC": "0xe727D925Ab233273d87fAb6Da58446Ed610CEdC7",
"COMP": "0xCAF841C852132f32738eecbd0b4f5d482e16b262",
"WBTC": "0x5171Be04CdBF5e958a947f7CFED4cAb0EE0D329d"
},
"modules": {
"installer": "0x537E3F6913D9851127f4E26401E3145684f6a433",
"markets": "0xe1DEf83bEF24f9dD5EfdCC79FF21c2a9D3D462B8",
"liquidation": "0x81E8C68CAD8BDb4F751A3a6cA78f3EC51bDc13d5",
"governance": "0xf334f61Eb92F0174AF1e54e0E74A0377050c95b0",
"exec": "0xE14B8ad1d5040495deD2CA0D21FC39c15b76a0A3",
"swap": "0xe1c9f61F8934A9Ac2a84a47cde5662b141D5e940",
"swapHub": "0xeF41850794021D5C95504Ea2b748E6819A79d776",
"eToken": "0x4aC1d1ba6325F3b0B210De5Ea0e7F8c54A7676B1",
"dToken": "0x98A9728262558BbBbD18921Be51b0Ee0CD7d21B6",
"riskManager": "0x3BBC61d81035eD583fFb675d230eECb30D934Fde",
"irmDefault": "0xdE76ccBae10010116fCA4dc92A6AacA5918c0FDb",
"irmZero": "0x93eD364a685c26c55b0Dd8da9baBDf62aF8792C2",
"irmFixed": "0x46B5cC46EA4954Def036F8eD261b0Da6eD0E9F35",
"irmLinear": "0x0fdd3Ba574f728A32550334Ed1F09545dE05A8c0"
},
"chainlinkCompatOracles": {
"EUL": "0x90E644678b43399659010DD07259ED61E372ddb5",
"WETH": "0x1231343C8595FC2Da9C16F871e000fa69B68b9b8",
"USDC": "0xCb8Ca7100Cf883769364BAd2324E710E8C17c96f",
"COMP": "0x7A9921787a89A49c828667CaA7BBE48010B65D33",
"WBTC": "0xD3f45CD686167F81a3a17Cf6Ec95cF14F13be70C"
},
"swapHandlers": {
"swapHandlerUniswapV3": "0x38455c5c800af093789353b183E36B2b0BeC0876",
"swapHandler1Inch": "0x61e0F68EcDCb9E7937Ebd2FCAba3f03601500C02",
"swapHandlerUniAutoRouter": "0x040bEEaC03a1A6BD2E7451Cf05b3f943A947eBFf"
},
"uniswapV3Factory": "0x161a51ff21Bf7dCEb17Be5A4D4F5F1fe8DdEbB33",
"invariantChecker": "0xdb4B1ccdD88e7e93c2A17bF4e3f270a61189B3E9",
"flashLoanNativeTest": "0x83a4bA59679fD4D5a92cB6692b4CDA5E3A1765D6",
"flashLoanAdaptorTest": "0xeE0CF99D092f46D5c2D4446f4b3A8CC72aDEDc55",
"flashLoanAdaptorTest2": "0x324219113D289836554748D24946C962eA4a1b62",
"simpleUniswapPeriphery": "0x6c53375FcEA59412f406E007F5a212E92B651db4",
"euler": "0x18b88C623525909B59BC5f537f03F8f08e9a1823",
"eulerSimpleLens": "0xA2a2f0381e7EdE59053ef123d629b228E641677B",
"deltaBalances": "0xcFd58C5B2A340b2eB1BCf27904a2f406E9f2d3F8",
"eulerGeneralView": "0x251835998B36706e9D2c9A105f2acC4b2Ad73FEa",
"installer": "0x7E3498E8C350F90C6Da1197f48d41F14A817Be09",
"markets": "0x6f6404301D5143C319a81508291A8799370E1829",
"liquidation": "0xe4764E5D4A23C344A22bf0Ba518992666f9D0c5E",
"governance": "0xFbBf16Cb3c98EF58463B7e7693f71aaE84c5f4c9",
"exec": "0x28F980c522D463905eE7F55e4A3c8001cAb3A848",
"swap": "0x8834CEfEc3968a82C5B084B936a47D8c26f0e87F",
"swapHub": "0x00E8Ba61516E8FD2373bcc5cC015088323fA62fE",
"flashLoan": "0x0E02AE5a5Cddd2eD61541f1a3DA39e81E15aea6e",
"testERC20TokenFaucet": "0x427Dc179e9Aabbf890322c88B5b7eCB449D7a224",
"eulStakes": "0x380F43Fee8a1D30B2FFf3e1Bea84366c72064954",
"eulDistributor": "0x37987fE00Ec11dCE3767328188C28fd06F38b8A7"
}
54 changes: 54 additions & 0 deletions addresses/euler-addresses-bsctestnet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"tokens": {
"WETH": "0x594a6993bB7A533132D65001a7C99fC66Fae38F4",
"EUL": "0x427Dc179e9Aabbf890322c88B5b7eCB449D7a224",
"USDT": "0x69632F2DB366e9Af8fdb767F674B0F0e4Da812C6",
"USDC": "0x8682B60F3dBaa29343D60c94D26CacdC0469Ed72",
"COMP": "0x3BBC61d81035eD583fFb675d230eECb30D934Fde",
"WBTC": "0x2d5C5c1be18a9B17A15D82575d895eC14B3d3549"
},
"modules": {
"installer": "0x93eD364a685c26c55b0Dd8da9baBDf62aF8792C2",
"markets": "0x46B5cC46EA4954Def036F8eD261b0Da6eD0E9F35",
"liquidation": "0x0fdd3Ba574f728A32550334Ed1F09545dE05A8c0",
"governance": "0x18b88C623525909B59BC5f537f03F8f08e9a1823",
"exec": "0xB0CEab555018312E427a3A45dCF549a048eE4B2E",
"swap": "0x251835998B36706e9D2c9A105f2acC4b2Ad73FEa",
"swapHub": "0x055CF59b5A3dd359b1c75D29C2Cb458c4fb04423",
"eToken": "0x38455c5c800af093789353b183E36B2b0BeC0876",
"dToken": "0x61e0F68EcDCb9E7937Ebd2FCAba3f03601500C02",
"riskManager": "0xd50F2D27d3CD53B6db360C30109FA421e49a42F2",
"irmDefault": "0x1d827FD7D55A246BE9975a3fDbba3a56B22Ddf44",
"irmZero": "0x19890FD87E13B2c09a5acD14Ffe7140Aa9A7b832",
"irmFixed": "0x299fBf933d9A2e92C641024cb324cF5bbbC6009e",
"irmLinear": "0x4DE6cbDd830b55b53334dE6D6DC77f6388c206db"
},
"chainlinkCompatOracles": {
"EUL": "0x380f43fee8a1d30b2fff3e1bea84366c72064954",
"USDT": "0xcfd58c5b2a340b2eb1bcf27904a2f406e9f2d3f8",
"USDC": "0x4bb4683355a8e5f505cc27f7dbdd4e30aaf2c5c1",
"WETH": "0x5171Be04CdBF5e958a947f7CFED4cAb0EE0D329d",
"COMP": "0xDdA8F0A53Dcdee94fD47079cf7e93e8Cf14aB55F",
"WBTC": "0xBc106Dec2E349EEF69D74bBc6b796b48941A5c49"
},
"swapHandlers": {},
"uniswapV3Factory": "0xe1c9f61F8934A9Ac2a84a47cde5662b141D5e940",
"invariantChecker": "0xeF41850794021D5C95504Ea2b748E6819A79d776",
"flashLoanNativeTest": "0x4aC1d1ba6325F3b0B210De5Ea0e7F8c54A7676B1",
"flashLoanAdaptorTest": "0x98A9728262558BbBbD18921Be51b0Ee0CD7d21B6",
"flashLoanAdaptorTest2": "0x0c813db988F760a6df9d6fa93fDe00e8F0d8d742",
"simpleUniswapPeriphery": "0xdE76ccBae10010116fCA4dc92A6AacA5918c0FDb",
"euler": "0x107c312Cd380e4d981809278a91f920C16d9d137",
"eulerSimpleLens": "0x7Dbd4D9eb53456360725DAC1FB6Dc0E86DEdf6CF",
"deltaBalances": "0xaF8a17B70062c3fA679f8241325C003a72a3a826",
"eulerGeneralView": "0x9150646E7229282A9fA1527Eb1bA356eB0F228E9",
"installer": "0x3E3c31700AB692416D08462F895A5b212Ae66cC1",
"markets": "0xbd60ad653F3B6b210f28E4D906C998626371579D",
"liquidation": "0x7a19E978A9bE334A8b26b4c7bE6CE6Ce04481152",
"governance": "0xac1e53ac6e6444DC1842BafFdD7E1D7CcFaf886a",
"exec": "0x0Cfd331692F44aa6C488f35FA71fFFBf5Ffe3719",
"swap": "0x22093cC59D9BA0c7380B8a88AF0578E9ad735d80",
"eulStakes": "0xBd6DEC1Da22d3385E7Bb07494aa2DF38C7da2E1F",
"eulDistributor": "0x733F408cC826140f64c3106C51A236D0f3E3fa28",
"swapHub": "0xC7BF6Cc3FaAF6c0217DB4ECad3339d7f7d461B7a"
}
4 changes: 3 additions & 1 deletion addresses/euler-addresses-goerli.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@
"CRV": "0x87351b560ebc1810CF33cBA7A0b508e2Cf36e821"
},
"eulerGeneralView": "0x486492546998494C224b294aE8c5a2982946220B",
"eulerSimpleLens": "0x62626a0f051B547b3182e55D1Eba667138790D8D",
"euler": "0x931172BB95549d0f29e10ae2D079ABA3C63318B3",
"installer": "0xB21fb96025c2b7F618ba9D3ae955D20Fa303b2D2",
"markets": "0x3EbC39b84B1F856fAFE9803A9e1Eae7Da016Da36",
"liquidation": "0x66326c072283feE63E1C3feF9BD024F8697EC1BB",
"governance": "0x496A8344497875D0D805167874f2f938aEa15600",
"exec": "0x4b62EB6797526491eEf6eF36D3B9960E5d66C394"
"exec": "0x4b62EB6797526491eEf6eF36D3B9960E5d66C394",
"testERC20TokenFaucet": "0x1215396CB53774dCE60978d7237F32042cF3a1db"
}
68 changes: 68 additions & 0 deletions addresses/euler-addresses-optimismgoerli.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"tokens": {
"EUL": "0x598419fB7cD8829E7471aFe1aFd5c2b35c9A82BC",
"WETH": "0x830e930B18C795192ac20e680bcDd3ce0984B4fB",
"DAI": "0x3189e190202050ae3E54f49bBD79569Ab48FF0dF",
"CRV": "0xc847F5f8de257D48B3c55CB868187381F6B441aA",
"DOUGH": "0x2815C34e27af8Cf632049De1693FbAA0FA10F307",
"REP": "0xfa8FABB91200A381fC74433B3aC3B8A6BF9eA3d0",
"UNI": "0x7FbE772506080fE1261d2Df2d7dA839Ec4Dfac99",
"USDT": "0x3d96928242D0585B45b1218f671875E209081fdd",
"USDC": "0x90E644678b43399659010DD07259ED61E372ddb5",
"WBTC": "0x1231343C8595FC2Da9C16F871e000fa69B68b9b8",
"COMP": "0xCb8Ca7100Cf883769364BAd2324E710E8C17c96f"
},
"modules": {
"installer": "0xe1DEf83bEF24f9dD5EfdCC79FF21c2a9D3D462B8",
"markets": "0x81E8C68CAD8BDb4F751A3a6cA78f3EC51bDc13d5",
"liquidation": "0xf334f61Eb92F0174AF1e54e0E74A0377050c95b0",
"governance": "0x594a6993bB7A533132D65001a7C99fC66Fae38F4",
"exec": "0xe1c9f61F8934A9Ac2a84a47cde5662b141D5e940",
"swap": "0xeF41850794021D5C95504Ea2b748E6819A79d776",
"swapHub": "0x4aC1d1ba6325F3b0B210De5Ea0e7F8c54A7676B1",
"eToken": "0x98A9728262558BbBbD18921Be51b0Ee0CD7d21B6",
"dToken": "0x0c813db988F760a6df9d6fa93fDe00e8F0d8d742",
"riskManager": "0x43696601BC6dcb54c59aae9E197910e8b5Ff1991",
"irmDefault": "0x93eD364a685c26c55b0Dd8da9baBDf62aF8792C2",
"irmZero": "0x46B5cC46EA4954Def036F8eD261b0Da6eD0E9F35",
"irmFixed": "0x0fdd3Ba574f728A32550334Ed1F09545dE05A8c0",
"irmLinear": "0x18b88C623525909B59BC5f537f03F8f08e9a1823"
},
"chainlinkCompatOracles": {
"EUL": "0xAF03639AC387a40f77B802C1fcD2363d103eAD56",
"DAI": "0x48bCAd5E4096ceD65aF6994b2B45834A818B0027",
"CRV": "0x313ec45290248bB4E5AD1AB4f5276beEc9224940",
"DOUGH": "0x29B6E822055fD49703e2298CBa55095Bc2CE0856",
"REP": "0xF870dfbe2107ee9C2989B058A30969727AB9924c",
"UNI": "0x62C8b71ce951Cbf020448ad552d1689C9bcfb9a4",
"USDT": "0x6ad40cE1C9D3A518dCE8D89295008ECA1bf0F321",
"USDC": "0xE392Ee380A9917D08B521E9488a66C83364678d2",
"WBTC": "0xe727D925Ab233273d87fAb6Da58446Ed610CEdC7",
"COMP": "0x161a51ff21Bf7dCEb17Be5A4D4F5F1fe8DdEbB33"
},
"swapHandlers": {
"swapHandlerUniswapV3": "0x61e0F68EcDCb9E7937Ebd2FCAba3f03601500C02",
"swapHandler1Inch": "0x040bEEaC03a1A6BD2E7451Cf05b3f943A947eBFf",
"swapHandlerUniAutoRouter": "0x1d827FD7D55A246BE9975a3fDbba3a56B22Ddf44"
},
"uniswapV3Factory": "0xdb4B1ccdD88e7e93c2A17bF4e3f270a61189B3E9",
"invariantChecker": "0x83a4bA59679fD4D5a92cB6692b4CDA5E3A1765D6",
"flashLoanNativeTest": "0xeE0CF99D092f46D5c2D4446f4b3A8CC72aDEDc55",
"flashLoanAdaptorTest": "0x324219113D289836554748D24946C962eA4a1b62",
"flashLoanAdaptorTest2": "0x6c53375FcEA59412f406E007F5a212E92B651db4",
"simpleUniswapPeriphery": "0x537E3F6913D9851127f4E26401E3145684f6a433",
"euler": "0xA2a2f0381e7EdE59053ef123d629b228E641677B",
"eulerSimpleLens": "0x251835998B36706e9D2c9A105f2acC4b2Ad73FEa",
"eulerGeneralView": "0x055CF59b5A3dd359b1c75D29C2Cb458c4fb04423",
"installer": "0x3333489a8cDF17AfBDeB20769f27F26A7FD3B1ea",
"markets": "0x307d90808d445cD87Fc3d978853a81d18558B900",
"liquidation": "0xbC6aC233c57e807DA4200f0c3a2D488ddB4633bb",
"governance": "0xC61b87C422Ef31BE093bF717cd14d19886358EEc",
"exec": "0xceA22af69B0689f02aDC192a821E616Fb4f9C160",
"swap": "0xa1Daafd1CD649d6BcfB300722378a3bF6E753B9b",
"swapHub": "0x39E9C04832782aF8291F0CaDbF5B70062c55D7b5",
"flashLoan": "0xbd3a377d413c42ed4e13DE94C2281C6487512178",
"testERC20TokenFaucet": "0x7A9921787a89A49c828667CaA7BBE48010B65D33",
"eulStakes": "0x7B8c159f1d6fC0721a4Ef0C05F22AD4D66700056",
"eulDistributor": "0x66c03CF5a7c7A1eBDda4258B5B78014d28Ab407b"
}
50 changes: 50 additions & 0 deletions addresses/euler-addresses-zktestnet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"tokens": {
"EUL": "0x1c4F67DC40ac702c09A9F3963Ac6189D700564E5",
"WETH": "0x3C3881391B8D0a77D4d3849D3Ab81277519716f5",
"DAI": "0x63F52bdcD30c75048E0967F048006EcCf4e4eC0F"
},
"modules": {
"riskManager": "0xe554593d260F98C195f716c9941Cd92d91E3Ce2B",
"installer": "0x52F6816A5928859E11147B47eD0Dea52e5BaB544",
"markets": "0xc849EF17E59190e135dd4E8effB8bfD97c67D646",
"liquidation": "0xa79751e8c5A275Beb129A932AC42BEca3618feeE",
"governance": "0x72e8f1588C123a498fC3AD56dA5D56Cc7Beb52E8",
"exec": "0x3bC48258E6beB6EAF8f9cD3918487EDA165C54A2",
"swap": "0x1125A7F5DA3B4EBFCA4Ff17aAEA0aF43e63B2162",
"swapHub": "0x225B3acfa0BD7360fF7672ee7260f1CF5842Ab83",
"eToken": "0xeE191Bf568F58a6d912935AFE46bF992e420Ce14",
"dToken": "0x22ea55e1af2C3Ec01b449fcAfcd1633Ed42bBE10",
"irmDefault": "0x60F1a67326cF70edE7b34e9470AB1BC366A738C4",
"irmZero": "0x90A2d723C2c5924d3B535d250A962C97fa5cC8d6",
"irmFixed": "0xc277C48455685e182A82ca35b41b14C006e024b2",
"irmLinear": "0x13aFf878623c85DBd51320517712F80Ce8abb5F0"
},
"chainlinkCompatOracles": {
"EUL": "0x34B5129e3333d4E3AfEd030F70C3736b6969133B",
"DAI": "0x11e6D43148B1fC3093d439665c2F194282Fb97eF"
},
"swapHandlers": {
"swapHandlerUniswapV3": "0x7Aec02c571Af43dB0210C5FB84b67dBe1b0c607D",
"swapHandler1Inch": "0x178F033f2110EFaA00bEcA551491D964A8648adE",
"swapHandlerUniAutoRouter": "0x45E938305c30bb3C903Cc39caf4F230c9a8ad8f6"
},
"invariantChecker": "0x8c2CF4901e0e32C99aC351e5621917c8Db982799",
"flashLoanNativeTest": "0x25e27ecb79c9B9A59c94Ecd2Ff7bD5bE3b9f1613",
"flashLoanAdaptorTest": "0xE4a0E39c6dd8393a0Cc726dbA302C38a25828856",
"flashLoanAdaptorTest2": "0x582f668705C4Ee49E7BcC0B2ECe7772b1ef86360",
"simpleUniswapPeriphery": "0xc87E16a12090750607C92d8E8b0574Eb64Fad44d",
"euler": "0x1DE1a47B6cb8ac33D8A9c6b17654F06BE892e740",
"eulerSimpleLens": "0x1089b0f0f564085C87ac2F953be894102485aAB5",
"eulerGeneralView": "0xD07a02B94495c73D81bF9e9228381b323173d2Eb",
"installer": "0x831Ba37998CBa6F571541eABe033f76c05C1e56E",
"markets": "0x65B6Ee2659939D5Af2794f4825b241D9322Da28d",
"liquidation": "0x62122e664CBcd671Fb2ff91A54CF81d462177151",
"governance": "0x9167bd3A88307391f98a48344196a784f0DcF7d7",
"exec": "0x29Bdb7F0AC23fC3A624917c70F0A633966D45552",
"swap": "0xF19C40a9d8D8D6ebEfE8974DFae3F89fEB3F823a",
"swapHub": "0x07f120683e611123d2Ab25be8C3DE9681A5e0c79",
"flashLoan": "0x9E5E5fB41B1f44eD7391F86Fd5Cc1a6ea9611D58",
"eulStakes": "0x12B8442C15093E3a33dBF13309085532217B7B70",
"eulDistributor": "0xb224c67b2Ea6c127AC24156C9C70e4fe2709294b"
}
4 changes: 4 additions & 0 deletions contracts/Constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,13 @@ abstract contract Constants {
uint8 internal constant DEFERLIQUIDITY__CLEAN = 1;
uint8 internal constant DEFERLIQUIDITY__DIRTY = 2;

// Fiat currency Reference Assets, as per ISO 4217
// https://en.wikipedia.org/wiki/ISO_4217
address internal constant REFERENCE_ASSET__USD = address(840);

// Pricing types

uint16 internal constant PRICINGTYPE__INVALID = 0;
uint16 internal constant PRICINGTYPE__PEGGED = 1;
uint16 internal constant PRICINGTYPE__UNISWAP3_TWAP = 2;
uint16 internal constant PRICINGTYPE__FORWARDED = 3;
Expand Down
104 changes: 104 additions & 0 deletions contracts/lib/UniswapV3Lib.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
// SPDX-License-Identifier: GPL-2.0-or-later

pragma solidity ^0.8.0;

import "../vendor/TickMath.sol";
import "../vendor/FullMath.sol";

interface IUniswapV3Factory {
function getPool(address tokenA, address tokenB, uint24 fee) external view returns (address pool);
}

interface IUniswapV3Pool {
function slot0() external view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked);
function liquidity() external view returns (uint128);
function observe(uint32[] calldata secondsAgos) external view returns (int56[] memory tickCumulatives, uint160[] memory liquidityCumulatives);
function observations(uint256 index) external view returns (uint32 blockTimestamp, int56 tickCumulative, uint160 liquidityCumulative, bool initialized);
function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;
}

library UniswapV3Lib {
function findBestUniswapPool(address factory, address underlying, address referenceAsset) internal view returns (address pool, uint24 fee) {
pool = address(0);
fee = 0;

uint24[4] memory fees = [uint24(3000), 10000, 500, 100];
uint128 bestLiquidity = 0;

for (uint i = 0; i < fees.length; ++i) {
address candidatePool = IUniswapV3Factory(factory).getPool(underlying, referenceAsset, fees[i]);
if (candidatePool == address(0)) continue;

uint128 liquidity = IUniswapV3Pool(candidatePool).liquidity();

if (pool == address(0) || liquidity > bestLiquidity) {
pool = candidatePool;
fee = fees[i];
bestLiquidity = liquidity;
}
}
}

function computeUniswapPoolAddress(address factory, bytes32 poolInitCodeHash, address tokenA, address tokenB, uint24 fee) internal pure returns (address) {
if (tokenA > tokenB) (tokenA, tokenB) = (tokenB, tokenA);

return address(uint160(uint256(keccak256(abi.encodePacked(
hex'ff',
factory,
keccak256(abi.encode(tokenA, tokenB, fee)),
poolInitCodeHash
)))));
}

function uniswapObserve(address pool, uint ago) internal view returns (uint, uint) {
uint32[] memory secondsAgos = new uint32[](2);

secondsAgos[0] = uint32(ago);
secondsAgos[1] = 0;

(bool success, bytes memory data) = pool.staticcall(abi.encodeWithSelector(IUniswapV3Pool.observe.selector, secondsAgos));

if (!success) {
if (keccak256(data) != keccak256(abi.encodeWithSignature("Error(string)", "OLD"))) revertBytes(data);

// The oldest available observation in the ring buffer is the index following the current (accounting for wrapping),
// since this is the one that will be overwritten next.

(,, uint16 index, uint16 cardinality,,,) = IUniswapV3Pool(pool).slot0();

(uint32 oldestAvailableAge,,,bool initialized) = IUniswapV3Pool(pool).observations((index + 1) % cardinality);

// If the following observation in a ring buffer of our current cardinality is uninitialized, then all the
// observations at higher indices are also uninitialized, so we wrap back to index 0, which we now know
// to be the oldest available observation.

if (!initialized) (oldestAvailableAge,,,) = IUniswapV3Pool(pool).observations(0);

// Call observe() again to get the oldest available

ago = block.timestamp - oldestAvailableAge;
secondsAgos[0] = uint32(ago);

(success, data) = pool.staticcall(abi.encodeWithSelector(IUniswapV3Pool.observe.selector, secondsAgos));
if (!success) revertBytes(data);
}

// If uniswap pool doesn't exist, then data will be empty and this decode will throw:

int56[] memory tickCumulatives = abi.decode(data, (int56[])); // don't bother decoding the liquidityCumulatives array

int24 tick = int24((tickCumulatives[1] - tickCumulatives[0]) / int56(int(ago)));

return (TickMath.getSqrtRatioAtTick(tick), ago);
}

function revertBytes(bytes memory errMsg) internal pure {
if (errMsg.length > 0) {
assembly {
revert(add(32, errMsg), mload(errMsg))
}
}

revert("e/uniswap-v3-twap-empty-error");
}
}
Loading