Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BAL Hookathon - Volatility Fee Hook #87

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"chain": "yarn workspace @se-2/foundry chain",
"fork": "yarn workspace @se-2/foundry fork",
"deploy": "yarn workspace @se-2/foundry deploy",
"deployWithHook": "yarn workspace @se-2/foundry deployWithHook",
"verify": "yarn workspace @se-2/foundry verify",
"deploy:verify": "yarn workspace @se-2/foundry deploy:verify",
"compile": "yarn workspace @se-2/foundry compile",
Expand Down
101,192 changes: 101,192 additions & 0 deletions packages/foundry/bin/contracts/hooks/VolatilityFee/VolatilityFeeHookV1-solc-output.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"inputs":[{"internalType":"contract IVault","name":"vault","type":"address"},{"internalType":"address","name":"allowedFactory","type":"address"},{"internalType":"address","name":"router","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"SenderIsNotVault","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"getHookFlags","outputs":[{"components":[{"internalType":"bool","name":"enableHookAdjustedAmounts","type":"bool"},{"internalType":"bool","name":"shouldCallBeforeInitialize","type":"bool"},{"internalType":"bool","name":"shouldCallAfterInitialize","type":"bool"},{"internalType":"bool","name":"shouldCallComputeDynamicSwapFee","type":"bool"},{"internalType":"bool","name":"shouldCallBeforeSwap","type":"bool"},{"internalType":"bool","name":"shouldCallAfterSwap","type":"bool"},{"internalType":"bool","name":"shouldCallBeforeAddLiquidity","type":"bool"},{"internalType":"bool","name":"shouldCallAfterAddLiquidity","type":"bool"},{"internalType":"bool","name":"shouldCallBeforeRemoveLiquidity","type":"bool"},{"internalType":"bool","name":"shouldCallAfterRemoveLiquidity","type":"bool"}],"internalType":"struct HookFlags","name":"","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"enum AddLiquidityKind","name":"","type":"uint8"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"amountsInRaw","type":"uint256[]"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onAfterAddLiquidity","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onAfterInitialize","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"enum RemoveLiquidityKind","name":"","type":"uint8"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"amountsOutRaw","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onAfterRemoveLiquidity","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"enum SwapKind","name":"kind","type":"uint8"},{"internalType":"contract IERC20","name":"tokenIn","type":"address"},{"internalType":"contract IERC20","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountInScaled18","type":"uint256"},{"internalType":"uint256","name":"amountOutScaled18","type":"uint256"},{"internalType":"uint256","name":"tokenInBalanceScaled18","type":"uint256"},{"internalType":"uint256","name":"tokenOutBalanceScaled18","type":"uint256"},{"internalType":"uint256","name":"amountCalculatedScaled18","type":"uint256"},{"internalType":"uint256","name":"amountCalculatedRaw","type":"uint256"},{"internalType":"address","name":"router","type":"address"},{"internalType":"address","name":"pool","type":"address"},{"internalType":"bytes","name":"userData","type":"bytes"}],"internalType":"struct AfterSwapParams","name":"","type":"tuple"}],"name":"onAfterSwap","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"enum AddLiquidityKind","name":"","type":"uint8"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onBeforeAddLiquidity","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onBeforeInitialize","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"enum RemoveLiquidityKind","name":"","type":"uint8"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onBeforeRemoveLiquidity","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"enum SwapKind","name":"kind","type":"uint8"},{"internalType":"uint256","name":"amountGivenScaled18","type":"uint256"},{"internalType":"uint256[]","name":"balancesScaled18","type":"uint256[]"},{"internalType":"uint256","name":"indexIn","type":"uint256"},{"internalType":"uint256","name":"indexOut","type":"uint256"},{"internalType":"address","name":"router","type":"address"},{"internalType":"bytes","name":"userData","type":"bytes"}],"internalType":"struct PoolSwapParams","name":"","type":"tuple"},{"internalType":"address","name":"","type":"address"}],"name":"onBeforeSwap","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"enum SwapKind","name":"kind","type":"uint8"},{"internalType":"uint256","name":"amountGivenScaled18","type":"uint256"},{"internalType":"uint256[]","name":"balancesScaled18","type":"uint256[]"},{"internalType":"uint256","name":"indexIn","type":"uint256"},{"internalType":"uint256","name":"indexOut","type":"uint256"},{"internalType":"address","name":"router","type":"address"},{"internalType":"bytes","name":"userData","type":"bytes"}],"internalType":"struct PoolSwapParams","name":"params","type":"tuple"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"staticSwapFeePercentage","type":"uint256"}],"name":"onComputeDynamicSwapFeePercentage","outputs":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"uint256","name":"dynamicSwapFeePercentage","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"factory","type":"address"},{"internalType":"address","name":"pool","type":"address"},{"components":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"enum TokenType","name":"tokenType","type":"uint8"},{"internalType":"contract IRateProvider","name":"rateProvider","type":"address"},{"internalType":"bool","name":"paysYieldFees","type":"bool"}],"internalType":"struct TokenConfig[]","name":"","type":"tuple[]"},{"components":[{"internalType":"bool","name":"disableUnbalancedLiquidity","type":"bool"},{"internalType":"bool","name":"enableAddLiquidityCustom","type":"bool"},{"internalType":"bool","name":"enableRemoveLiquidityCustom","type":"bool"},{"internalType":"bool","name":"enableDonation","type":"bool"}],"internalType":"struct LiquidityManagement","name":"","type":"tuple"}],"name":"onRegister","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
60e0346100f757601f610d1738819003918201601f19168301916001600160401b038311848410176100fb578084926060946040528339810103126100f7578051906001600160a01b03821682036100f75761006960406100626020840161010f565b920161010f565b33156100e4575f8054336001600160a01b0319821681178355604051959290916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a360805260a05260c052610bf39081610124823960805181610674015260a05181505060c051816106b00152f35b631e4fbdf760e01b5f525f60045260245ffd5b5f80fd5b634e487b7160e01b5f52604160045260245ffd5b51906001600160a01b03821682036100f75756fe60806040526004361015610011575f80fd5b5f3560e01c80630b89f182146105e657806318b6eb55146105a55780631c149e28146105555780632754888d146104e757806338be241d1461049757806345421ec71461044a5780635211fa7714610411578063715018a6146103ba5780638da5cb5b14610393578063976907cc146102d1578063a0e8f5ac14610278578063ba5f9f40146101e0578063d77153a71461013c5763f2fde38b146100b3575f80fd5b34610138576020366003190112610138576100cc610825565b6100d4610aad565b6001600160a01b03168015610125575f80546001600160a01b03198116831782556001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a3005b631e4fbdf760e01b5f525f60045260245ffd5b5f80fd5b34610138575f36600319011261013857610154610a52565b50610140610160610a52565b61012060608201916001835260405192815115158452602082015115156020850152604082015115156040850152511515606084015260808101511515608084015260a0810151151560a084015260c0810151151560c084015260e0810151151560e0840152610100810151151561010084015201511515610120820152f35b346101385760e0366003190112610138576101f9610825565b5061020261083b565b5060046044351015610138576084356001600160401b0381116101385761022d903690600401610889565b5060a4356001600160401b0381116101385761024d903690600401610889565b5060c4356001600160401b0381116101385761026d9036906004016108e6565b5060206040515f8152f35b34610138576060366003190112610138576004356001600160401b0381116101385760e06003198236030112610138576102c36040916102b661083b565b50604435906004016109d4565b825191151582526020820152f35b3461013857610100366003190112610138576102eb610825565b506102f461083b565b5060056044351015610138576064356001600160401b0381116101385761031f903690600401610889565b506084356001600160401b0381116101385761033f903690600401610889565b60c4356001600160401b0381116101385761035e903690600401610889565b5060e435906001600160401b0382116101385761038261038f9236906004016108e6565b506040519182918261093b565b0390f35b34610138575f366003190112610138575f546040516001600160a01b039091168152602090f35b34610138575f366003190112610138576103d2610aad565b5f80546001600160a01b0319811682556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b34610138576040366003190112610138576004356001600160401b0381116101385760e09060031990360301126101385761026d61083b565b346101385760e036600319011261013857610463610825565b5061046c61083b565b5060056044351015610138576064356001600160401b0381116101385761022d903690600401610889565b34610138576060366003190112610138576004356001600160401b038111610138576104c7903690600401610889565b506044356001600160401b0381116101385761026d9036906004016108e6565b346101385761010036600319011261013857610501610825565b5061050a61083b565b5060046044351015610138576084356001600160401b03811161013857610535903690600401610889565b5060a4356001600160401b0381116101385761033f903690600401610889565b34610138576040366003190112610138576004356001600160401b03811161013857610585903690600401610889565b506024356001600160401b0381116101385761026d9036906004016108e6565b34610138576020366003190112610138576004356001600160401b0381116101385761018090600319903603011261013857604080515f81525f6020820152f35b346101385760e0366003190112610138576105ff610825565b61060761083b565b906044356001600160401b0381116101385736602382011215610138578060040135906024602061063784610872565b6106446040519182610851565b848152019260071b8201019036821161013857602401915b818310610784575050506080606319360112610138577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163303610771576001600160a01b03908116917f0000000000000000000000000000000000000000000000000000000000000000909116821490816106e8575b6020826040519015158152f35b604051636634b75360e01b81526001600160a01b0390911660048201529160209150829060249082905afa8015610766575f9061072a575b60209150826106db565b506020813d60201161075e575b8161074460209383610851565b810103126101385751801515810361013857602090610720565b3d9150610737565b6040513d5f823e3d90fd5b63089676d560e01b5f523360045260245ffd5b6080833603126101385760405190608082018281106001600160401b038211176108115760405283356001600160a01b03811681036101385782526020840135600281101561013857602083015260408401356001600160a01b0381168103610138576040830152606084013590811515820361013857826020926060608095015281520192019161065c565b634e487b7160e01b5f52604160045260245ffd5b600435906001600160a01b038216820361013857565b602435906001600160a01b038216820361013857565b90601f801991011681019081106001600160401b0382111761081157604052565b6001600160401b0381116108115760051b60200190565b9080601f830112156101385781356108a081610872565b926108ae6040519485610851565b81845260208085019260051b82010192831161013857602001905b8282106108d65750505090565b81358152602091820191016108c9565b81601f82011215610138578035906001600160401b038211610811576040519261091a601f8401601f191660200185610851565b8284526020838301011161013857815f926020809301838601378301015290565b6020606060408301925f81526040838201528451809452019201905f5b8181106109655750505090565b8251845260209384019390920191600101610958565b903590601e198136030182121561013857018035906001600160401b03821161013857602001918160051b3603831361013857565b91908110156109c05760051b0190565b634e487b7160e01b5f52603260045260245ffd5b91905f925f813560028110156101385780610a1c575050610a179293506020610a0e610a03604084018461097b565b6060850135916109b0565b35910135610ad3565b600191565b9093929190600114610a2c575050565b90919350610a1792506020610a0e610a47604084018461097b565b6080850135916109b0565b6040519061014082018281106001600160401b03821117610811576040525f610120838281528260208201528260408201528260608201528260808201528260a08201528260c08201528260e0820152826101008201520152565b5f546001600160a01b03163303610ac057565b63118cdaa760e01b5f523360045260245ffd5b9060288102811590828104602814821715610b0c5760649004831115610b2057505050603281029080820460321490151715610b0c5790565b634e487b7160e01b5f52601160045260245ffd5b601e8202828104601e14821715610b0c5760649004831115610b5557505050601481029080820460141490151715610b0c5790565b60148202828104601414821715610b0c5760649004831115610b8a57505050600a810290808204600a1490151715610b0c5790565b600a8202918204600a141715610b0c57606490041015610bba57600581029080820460051490151715610b0c5790565b9056fea2646970667358221220beffdca6ea749b6439101173d06e3b090d6b29d424f697a6f498de1c61d8c63364736f6c634300081b0033
Loading