diff --git a/.gitignore b/.gitignore index 04e92bf..4cf8e15 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ out/ !/broadcast /broadcast/*/31337/ /broadcast/**/dry-run/ +broadcast/ # Docs docs/ diff --git a/broadcast/STEXDeploy.s.sol/999/run-latest.json b/broadcast/STEXDeploy.s.sol/999/run-latest.json index a129361..e68dc06 100644 --- a/broadcast/STEXDeploy.s.sol/999/run-latest.json +++ b/broadcast/STEXDeploy.s.sol/999/run-latest.json @@ -1,18 +1,21 @@ { "transactions": [ { - "hash": "0x3b763913e2c659fe57619df47ccff8de0ac228e81dd1f01fb4b35ed78471102b", - "transactionType": "CREATE", + "hash": "0x7fc0ecbb1e23940263e0c379dcac2596907cedaff4e68fafbce20bf793a1072c", + "transactionType": "CALL", "contractName": null, - "contractAddress": "0x36bafeb0f12a13ca579ed4080d95ac74f59e98e0", - "function": null, - "arguments": null, + "contractAddress": "0x18cdf91af34e44d4b4cf5e86b31b42bd86569418", + "function": "transferOwnership(address)", + "arguments": [ + "0xe26dA5cBf101bDA4028E2B3208c32424f5D09421" + ], "transaction": { "from": "0x388e360edaac94372df1a2663ffe52671bbd8b58", - "gas": "0x121eed", + "to": "0x18cdf91af34e44d4b4cf5e86b31b42bd86569418", + "gas": "0x9a14", "value": "0x0", - "input": "0x610100604052348015610010575f80fd5b506040516110bf3803806110bf83398101604081905261002f9161010e565b826001600160a01b03811661005d57604051631e4fbdf760e01b81525f600482015260240160405180910390fd5b610066816100a4565b506001600160a01b0395861660805293851660a05291841660c05250600180546001600160a01b031916919093161790915561ffff1660e052610188565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b0381168114610109575f80fd5b919050565b5f805f805f8060c08789031215610123575f80fd5b61012c876100f3565b955061013a602088016100f3565b9450610148604088016100f3565b9350610156606088016100f3565b9250610164608088016100f3565b915060a087015161ffff8116811461017a575f80fd5b809150509295509295509295565b60805160a05160c05160e051610eb86102075f395f818161022a01526105a401525f8181610148015281816102b7015281816104a9015281816104eb0152818161056f015261071501525f81816101aa0152818161079a015261097001525f818160f7015281816102ee0152818161050d01526105ce0152610eb85ff3fe608060405234801561000f575f80fd5b50600436106100d9575f3560e01c806376d5de8511610088578063b8dc491b11610063578063b8dc491b146101fc578063c66f24551461020f578063d8b6d25214610225578063f2fde38b1461025f575f80fd5b806376d5de85146101a55780638da5cb5b146101cc578063b6b55f25146101e9575f80fd5b80634771eeaf116100b85780634771eeaf1461016a5780635ea125571461017d578063715018a61461019d575f80fd5b8062f714ce146100dd57806316f0115b146100f257806338d52e0f14610143575b5f80fd5b6100f06100eb366004610de2565b610272565b005b6101197f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6101197f000000000000000000000000000000000000000000000000000000000000000081565b6100f0610178366004610e0c565b61035d565b6001546101199073ffffffffffffffffffffffffffffffffffffffff1681565b6100f0610474565b6101197f000000000000000000000000000000000000000000000000000000000000000081565b5f5473ffffffffffffffffffffffffffffffffffffffff16610119565b6100f06101f7366004610e2c565b610487565b6100f061020a366004610e43565b610628565b610217610940565b60405190815260200161013a565b61024c7f000000000000000000000000000000000000000000000000000000000000000081565b60405161ffff909116815260200161013a565b6100f061026d366004610e0c565b6109f3565b61027a610a5b565b6040517f69328dec00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000811660048301526024820184905282811660448301527f000000000000000000000000000000000000000000000000000000000000000016906369328dec906064016020604051808303815f875af1158015610334573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103589190610e6b565b505050565b60015473ffffffffffffffffffffffffffffffffffffffff1633146103ae576040517f479ccbfc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff81166103fb576040517f495350ef00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527fe270c0f13fe1cbdfd2d272034026790a686d70c42e3ecfddc188ffc18e74d08c9060200160405180910390a150565b61047c610a5b565b6104855f610aad565b565b61048f610a5b565b6104d173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016333084610b21565b61053273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000167f000000000000000000000000000000000000000000000000000000000000000083610bb0565b6040517f617ba03700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018390523060448301527f000000000000000000000000000000000000000000000000000000000000000061ffff1660648301527f0000000000000000000000000000000000000000000000000000000000000000169063617ba037906084015f604051808303815f87803b15801561060f575f80fd5b505af1158015610621573d5f803e3d5ffd5b5050505050565b60015473ffffffffffffffffffffffffffffffffffffffff163314610679576040517f479ccbfc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff82166106c6576040517f495350ef00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8116610713576040517f495350ef00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610798576040517fbb42845a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361081d576040517f4401eb1600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201525f9073ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa158015610887573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108ab9190610e6b565b90508015610358576108d473ffffffffffffffffffffffffffffffffffffffff84168383610c87565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fed679328aebf74ede77ae09efcf36e90244f83643dadac1c2d9f0b21a46f6ab78360405161093391815260200190565b60405180910390a3505050565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201525f907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa1580156109ca573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109ee9190610e6b565b905090565b6109fb610a5b565b73ffffffffffffffffffffffffffffffffffffffff8116610a4f576040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081525f60048201526024015b60405180910390fd5b610a5881610aad565b50565b5f5473ffffffffffffffffffffffffffffffffffffffff163314610485576040517f118cdaa7000000000000000000000000000000000000000000000000000000008152336004820152602401610a46565b5f805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60405173ffffffffffffffffffffffffffffffffffffffff8481166024830152838116604483015260648201839052610baa9186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050610cc5565b50505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b300000000000000000000000000000000000000000000000000000000179052610c3c8482610d64565b610baa5760405173ffffffffffffffffffffffffffffffffffffffff84811660248301525f6044830152610c7d91869182169063095ea7b390606401610b63565b610baa8482610cc5565b60405173ffffffffffffffffffffffffffffffffffffffff83811660248301526044820183905261035891859182169063a9059cbb90606401610b63565b5f8060205f8451602086015f885af180610ce4576040513d5f823e3d81fd5b50505f513d91508115610cfb578060011415610d15565b73ffffffffffffffffffffffffffffffffffffffff84163b155b15610baa576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610a46565b5f805f8060205f8651602088015f8a5af192503d91505f519050828015610db057508115610d955780600114610db0565b5f8673ffffffffffffffffffffffffffffffffffffffff163b115b9695505050505050565b803573ffffffffffffffffffffffffffffffffffffffff81168114610ddd575f80fd5b919050565b5f8060408385031215610df3575f80fd5b82359150610e0360208401610dba565b90509250929050565b5f60208284031215610e1c575f80fd5b610e2582610dba565b9392505050565b5f60208284031215610e3c575f80fd5b5035919050565b5f8060408385031215610e54575f80fd5b610e5d83610dba565b9150610e0360208401610dba565b5f60208284031215610e7b575f80fd5b505191905056fea26469706673582212205e5870594c285d3d2223a12df8b6c2180d9176b64f37598685ab6316d63bb0af64736f6c63430008190033000000000000000000000000cecce0eb9dd2ef7996e01e25dd70e461f918a14b0000000000000000000000007c97cd7b57b736c6ad74fae97c0e21e856251dcf000000000000000000000000555555555555555555555555555555555555555500000000000000000000000040ba056b004edd0b572509a1276fd8530cf2bb7f000000000000000000000000e26da5cbf101bda4028e2b3208c32424f5d094210000000000000000000000000000000000000000000000000000000000000002", - "nonce": "0xce", + "input": "0xf2fde38b000000000000000000000000e26da5cbf101bda4028e2b3208c32424f5d09421", + "nonce": "0x102", "chainId": "0x3e7" }, "additionalContracts": [], @@ -22,42 +25,42 @@ "receipts": [ { "status": "0x1", - "cumulativeGasUsed": "0x10690e", + "cumulativeGasUsed": "0x401fe", "logs": [ { - "address": "0x36bafeb0f12a13ca579ed4080d95ac74f59e98e0", + "address": "0x18cdf91af34e44d4b4cf5e86b31b42bd86569418", "topics": [ "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", - "0x0000000000000000000000000000000000000000000000000000000000000000", - "0x00000000000000000000000040ba056b004edd0b572509a1276fd8530cf2bb7f" + "0x000000000000000000000000388e360edaac94372df1a2663ffe52671bbd8b58", + "0x000000000000000000000000e26da5cbf101bda4028e2b3208c32424f5d09421" ], "data": "0x", - "blockHash": "0x22bb21d6841008361c2cd45c0ebb935bce19bccc34ed97b4bc9178a26274809a", - "blockNumber": "0x1da7d5", - "blockTimestamp": "0x67ed6914", - "transactionHash": "0x3b763913e2c659fe57619df47ccff8de0ac228e81dd1f01fb4b35ed78471102b", - "transactionIndex": "0x4", - "logIndex": "0x4", + "blockHash": "0x8bfdf723a2caf3958994df866de0177fc6d19bbf0d7627311b263cadf9ce0bc7", + "blockNumber": "0x2b0d55", + "blockTimestamp": "0x68075820", + "transactionHash": "0x7fc0ecbb1e23940263e0c379dcac2596907cedaff4e68fafbce20bf793a1072c", + "transactionIndex": "0x2", + "logIndex": "0x6", "removed": false } ], - "logsBloom": "0x00000004000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000001000000000000000000000000000000000000060000000000000000000800000000000000000000000000000000400000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000400000000000000000000000000000000000000000000000800", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000000000000000100000000000000000004000000000000000000000000000000000000000000000000000000001000000000000000000000000000200002000000000000000000400100000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000", "type": "0x2", - "transactionHash": "0x3b763913e2c659fe57619df47ccff8de0ac228e81dd1f01fb4b35ed78471102b", - "transactionIndex": "0x4", - "blockHash": "0x22bb21d6841008361c2cd45c0ebb935bce19bccc34ed97b4bc9178a26274809a", - "blockNumber": "0x1da7d5", - "gasUsed": "0xdf068", - "effectiveGasPrice": "0x6efc6bf", + "transactionHash": "0x7fc0ecbb1e23940263e0c379dcac2596907cedaff4e68fafbce20bf793a1072c", + "transactionIndex": "0x2", + "blockHash": "0x8bfdf723a2caf3958994df866de0177fc6d19bbf0d7627311b263cadf9ce0bc7", + "blockNumber": "0x2b0d55", + "gasUsed": "0x6f8e", + "effectiveGasPrice": "0x3a06a5a7c", "from": "0x388e360edaac94372df1a2663ffe52671bbd8b58", - "to": null, - "contractAddress": "0x36bafeb0f12a13ca579ed4080d95ac74f59e98e0" + "to": "0x18cdf91af34e44d4b4cf5e86b31b42bd86569418", + "contractAddress": null } ], "libraries": [], "pending": [], "returns": {}, - "timestamp": 1743612181, + "timestamp": 1745311777, "chain": 999, - "commit": "1473466" + "commit": "bf56312" } \ No newline at end of file diff --git a/broadcast/STEXLensDeploy.s.sol/999/run-latest.json b/broadcast/STEXLensDeploy.s.sol/999/run-latest.json index 894038d..571833c 100644 --- a/broadcast/STEXLensDeploy.s.sol/999/run-latest.json +++ b/broadcast/STEXLensDeploy.s.sol/999/run-latest.json @@ -1,18 +1,18 @@ { "transactions": [ { - "hash": "0x89fad49259a188bceab20f4c327de71de707519062f3a20d55513ca52db47e7a", + "hash": "0x08c8159d3bed3ce47c27dc466d14c8d333396f2a2403e4d7e40576a99bb6d2a5", "transactionType": "CREATE", "contractName": "STEXLens", - "contractAddress": "0x68675dc8406252b6950128f6504a5e287ef24ed0", + "contractAddress": "0x7a8cc0da859103313cd6324d932c718db41b6e64", "function": null, "arguments": null, "transaction": { "from": "0x388e360edaac94372df1a2663ffe52671bbd8b58", - "gas": "0x197fea", + "gas": "0x1d7457", "value": "0x0", - "input": "0x6080604052348015600e575f80fd5b506116508061001c5f395ff3fe608060405234801561000f575f80fd5b506004361061004a575f3560e01c806341f89cf61461004e578063779cda631461008e57806398da0b61146100af578063c3933c46146100d2575b5f80fd5b61006161005c3660046113a8565b6100fa565b604080519586526020860194909452928401919091526060830152608082015260a0015b60405180910390f35b6100a161009c3660046113c3565b6103ab565b604051908152602001610085565b6100c26100bd3660046113c3565b610796565b6040519015158152602001610085565b6100e56100e03660046113ed565b6109f6565b60408051928352602083019190915201610085565b5f805f805f808690505f8173ffffffffffffffffffffffffffffffffffffffff1663ef2238166040518163ffffffff1660e01b8152600401602060405180830381865afa15801561014d573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101719190611430565b90508173ffffffffffffffffffffffffffffffffffffffff166316f0115b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101bc573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101e09190611430565b73ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b81526004016040805180830381865afa158015610227573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061024b919061144b565b80965081985050508073ffffffffffffffffffffffffffffffffffffffff1663fc02abec6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561029c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102c0919061146d565b95508073ffffffffffffffffffffffffffffffffffffffff16634083902e6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561030b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061032f919061146d565b93508073ffffffffffffffffffffffffffffffffffffffff1663a2fd92366040518163ffffffff1660e01b8152600401602060405180830381865afa15801561037a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061039e919061146d565b9250505091939590929450565b5f808390505f8473ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103fa573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061041e919061146d565b9050805f0361043c576104336103e8856114b1565b92505050610790565b5f8273ffffffffffffffffffffffffffffffffffffffff1663ef2238166040518163ffffffff1660e01b8152600401602060405180830381865afa158015610486573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104aa9190611430565b90505f808473ffffffffffffffffffffffffffffffffffffffff166316f0115b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104f7573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061051b9190611430565b73ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b81526004016040805180830381865afa158015610562573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610586919061144b565b915091505f8373ffffffffffffffffffffffffffffffffffffffff1663fc02abec6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105d4573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105f8919061146d565b61060290846114c4565b90505f8473ffffffffffffffffffffffffffffffffffffffff1663a2fd92366040518163ffffffff1660e01b8152600401602060405180830381865afa15801561064e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610672919061146d565b90505f6107858a88848973ffffffffffffffffffffffffffffffffffffffff1663ea949a1c886040518263ffffffff1660e01b81526004016106b691815260200190565b602060405180830381865afa1580156106d1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106f5919061146d565b8a73ffffffffffffffffffffffffffffffffffffffff16634083902e6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561073e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610762919061146d565b61076c908a6114c4565b61077691906114c4565b61078091906114b1565b611226565b985050505050505050505b92915050565b5f808373ffffffffffffffffffffffffffffffffffffffff1663ef2238166040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107e1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108059190611430565b6040517fa628320c000000000000000000000000000000000000000000000000000000008152600481018590529091505f9073ffffffffffffffffffffffffffffffffffffffff83169063a628320c90602401606060405180830381865afa158015610873573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061089791906114d7565b905080602001516bffffffffffffffffffffffff165f036108bc575f92505050610790565b80602001516bffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1663b2d218566040518163ffffffff1660e01b8152600401602060405180830381865afa158015610918573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061093c919061146d565b101561094c575f92505050610790565b80602001516bffffffffffffffffffffffff16816040015161096e91906114c4565b8273ffffffffffffffffffffffffffffffffffffffff16635ae962f76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109b7573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109db919061146d565b10156109eb575f92505050610790565b506001949350505050565b5f805f8590505f8673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a46573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a6a919061146d565b9050805f03610a80575f8093509350505061121e565b5f805f8473ffffffffffffffffffffffffffffffffffffffff1663ef2238166040518163ffffffff1660e01b8152600401602060405180830381865afa158015610acc573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610af09190611430565b9050610b256040518060c001604052805f81526020015f81526020015f81526020015f81526020015f81526020015f81525090565b8573ffffffffffffffffffffffffffffffffffffffff166316f0115b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b6e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b929190611430565b73ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b81526004016040805180830381865afa158015610bd9573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610bfd919061144b565b60408084019190915260208084019290925286835280517ffc02abec00000000000000000000000000000000000000000000000000000000815290515f9273ffffffffffffffffffffffffffffffffffffffff86169263fc02abec92600480830193928290030181865afa158015610c77573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c9b919061146d565b90505f8373ffffffffffffffffffffffffffffffffffffffff166364697b998573ffffffffffffffffffffffffffffffffffffffff1663a2fd92366040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d03573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d27919061146d565b6040518263ffffffff1660e01b8152600401610d4591815260200190565b602060405180830381865afa158015610d60573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d84919061146d565b90505f81838560200151610d9891906114c4565b1115610dcc57610dc582848660200151610db291906114c4565b610dbc91906114b1565b85518f90611226565b9650610df8565b610df583856020015184610de091906114b1565b610dea91906114b1565b85518f9060016112fc565b90505b610e688573ffffffffffffffffffffffffffffffffffffffff16634083902e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e44573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610dbc919061146d565b606085015260408401518451610e8091908f90611226565b8460600151610e8f91906114c4565b95508015610f43576040517fea949a1c000000000000000000000000000000000000000000000000000000008152600481018290525f9073ffffffffffffffffffffffffffffffffffffffff87169063ea949a1c90602401602060405180830381865afa158015610f02573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f26919061146d565b9050808711610f35575f610f3f565b610f3f81886114b1565b9650505b5050508815611214575f8673ffffffffffffffffffffffffffffffffffffffff1663f2d656178873ffffffffffffffffffffffffffffffffffffffff16630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fb2573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fd69190611430565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815273ffffffffffffffffffffffffffffffffffffffff90911660048201526024810188905260016044820152606401602060405180830381865afa15801561104b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061106f919061146d565b6040517fea949a1c000000000000000000000000000000000000000000000000000000008152600481018790529091505f9073ffffffffffffffffffffffffffffffffffffffff85169063ea949a1c90602401602060405180830381865afa1580156110dd573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611101919061146d565b90506127108873ffffffffffffffffffffffffffffffffffffffff166316f0115b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561114f573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111739190611430565b73ffffffffffffffffffffffffffffffffffffffff16632ddf0fa16040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111bb573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111df919061146d565b6111e984846114b1565b6111f39190611575565b6111fd91906115b9565b608084015261120c82866114c4565b94505f955050505b5091955093505050505b935093915050565b5f838302817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff85870982811083820303915050805f036112795783828161126f5761126f61158c565b04925050506112f5565b808411611290576112906003851502601118611347565b5f848688095f868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150505b9392505050565b5f61132961130983611358565b801561132457505f848061131f5761131f61158c565b868809115b151590565b611334868686611226565b61133e91906114c4565b95945050505050565b634e487b715f52806020526024601cfd5b5f600282600381111561136d5761136d6115cc565b61137791906115f9565b60ff166001149050919050565b73ffffffffffffffffffffffffffffffffffffffff811681146113a5575f80fd5b50565b5f602082840312156113b8575f80fd5b81356112f581611384565b5f80604083850312156113d4575f80fd5b82356113df81611384565b946020939093013593505050565b5f805f606084860312156113ff575f80fd5b833561140a81611384565b92506020840135915060408401358015158114611425575f80fd5b809150509250925092565b5f60208284031215611440575f80fd5b81516112f581611384565b5f806040838503121561145c575f80fd5b505080516020909101519092909150565b5f6020828403121561147d575f80fd5b5051919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b8181038181111561079057610790611484565b8082018082111561079057610790611484565b5f606082840312156114e7575f80fd5b6040516060810181811067ffffffffffffffff8211171561152f577f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b604052825161153d81611384565b815260208301516bffffffffffffffffffffffff8116811461155d575f80fd5b60208201526040928301519281019290925250919050565b808202811582820484141761079057610790611484565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f826115c7576115c761158c565b500490565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b5f60ff83168061160b5761160b61158c565b8060ff8416069150509291505056fea2646970667358221220fc16270055b383af52b6076293d461242cb64765f124203e98bfa24e42adb9e464736f6c63430008190033", - "nonce": "0xb7", + "input": "0x6080604052348015600e575f80fd5b506119ee8061001c5f395ff3fe608060405234801561000f575f80fd5b506004361061006f575f3560e01c8063bb0c85981161004d578063bb0c8598146100f7578063c3933c461461010a578063c6a1ba1c14610132575f80fd5b806341f89cf614610073578063779cda63146100b357806398da0b61146100d4575b5f80fd5b61008661008136600461170e565b610145565b604080519586526020860194909452928401919091526060830152608082015260a0015b60405180910390f35b6100c66100c1366004611729565b6103f6565b6040519081526020016100aa565b6100e76100e2366004611729565b6104f1565b60405190151581526020016100aa565b6100c6610105366004611753565b610751565b61011d61011836600461178b565b610769565b604080519283526020830191909152016100aa565b61011d610140366004611753565b610f99565b5f805f805f808690505f8173ffffffffffffffffffffffffffffffffffffffff1663ef2238166040518163ffffffff1660e01b8152600401602060405180830381865afa158015610198573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101bc91906117ce565b90508173ffffffffffffffffffffffffffffffffffffffff166316f0115b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610207573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061022b91906117ce565b73ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b81526004016040805180830381865afa158015610272573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061029691906117e9565b80965081985050508073ffffffffffffffffffffffffffffffffffffffff1663fc02abec6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102e7573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061030b919061180b565b95508073ffffffffffffffffffffffffffffffffffffffff16634083902e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610356573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061037a919061180b565b93508073ffffffffffffffffffffffffffffffffffffffff1663a2fd92366040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103c5573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103e9919061180b565b9250505091939590929450565b5f808390505f808273ffffffffffffffffffffffffffffffffffffffff166316f0115b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610446573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061046a91906117ce565b73ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b81526004016040805180830381865afa1580156104b1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104d591906117e9565b915091506104e58686848461128a565b93505050505b92915050565b5f808373ffffffffffffffffffffffffffffffffffffffff1663ef2238166040518163ffffffff1660e01b8152600401602060405180830381865afa15801561053c573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061056091906117ce565b6040517fa628320c000000000000000000000000000000000000000000000000000000008152600481018590529091505f9073ffffffffffffffffffffffffffffffffffffffff83169063a628320c90602401606060405180830381865afa1580156105ce573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105f29190611822565b905080602001516bffffffffffffffffffffffff165f03610617575f925050506104eb565b80602001516bffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1663b2d218566040518163ffffffff1660e01b8152600401602060405180830381865afa158015610673573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610697919061180b565b10156106a7575f925050506104eb565b80602001516bffffffffffffffffffffffff1681604001516106c991906118ed565b8273ffffffffffffffffffffffffffffffffffffffff16635ae962f76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610712573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610736919061180b565b1015610746575f925050506104eb565b506001949350505050565b5f61075e8585858561128a565b90505b949350505050565b5f805f8590505f8673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107b9573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107dd919061180b565b9050805f036107f3575f80935093505050610f91565b5f805f8473ffffffffffffffffffffffffffffffffffffffff1663ef2238166040518163ffffffff1660e01b8152600401602060405180830381865afa15801561083f573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061086391906117ce565b90506108986040518060c001604052805f81526020015f81526020015f81526020015f81526020015f81526020015f81525090565b8573ffffffffffffffffffffffffffffffffffffffff166316f0115b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108e1573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061090591906117ce565b73ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b81526004016040805180830381865afa15801561094c573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061097091906117e9565b60408084019190915260208084019290925286835280517ffc02abec00000000000000000000000000000000000000000000000000000000815290515f9273ffffffffffffffffffffffffffffffffffffffff86169263fc02abec92600480830193928290030181865afa1580156109ea573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a0e919061180b565b90505f8373ffffffffffffffffffffffffffffffffffffffff166364697b998573ffffffffffffffffffffffffffffffffffffffff1663a2fd92366040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a76573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a9a919061180b565b6040518263ffffffff1660e01b8152600401610ab891815260200190565b602060405180830381865afa158015610ad3573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610af7919061180b565b90505f81838560200151610b0b91906118ed565b1115610b3f57610b3882848660200151610b2591906118ed565b610b2f9190611900565b85518f90611595565b9650610b6b565b610b6883856020015184610b539190611900565b610b5d9190611900565b85518f90600161166b565b90505b610bdb8573ffffffffffffffffffffffffffffffffffffffff16634083902e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610bb7573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b2f919061180b565b606085015260408401518451610bf391908f90611595565b8460600151610c0291906118ed565b95508015610cb6576040517fea949a1c000000000000000000000000000000000000000000000000000000008152600481018290525f9073ffffffffffffffffffffffffffffffffffffffff87169063ea949a1c90602401602060405180830381865afa158015610c75573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c99919061180b565b9050808711610ca8575f610cb2565b610cb28188611900565b9650505b5050508815610f87575f8673ffffffffffffffffffffffffffffffffffffffff1663f2d656178873ffffffffffffffffffffffffffffffffffffffff16630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d25573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d4991906117ce565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815273ffffffffffffffffffffffffffffffffffffffff90911660048201526024810188905260016044820152606401602060405180830381865afa158015610dbe573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610de2919061180b565b6040517fea949a1c000000000000000000000000000000000000000000000000000000008152600481018790529091505f9073ffffffffffffffffffffffffffffffffffffffff85169063ea949a1c90602401602060405180830381865afa158015610e50573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e74919061180b565b90506127108873ffffffffffffffffffffffffffffffffffffffff166316f0115b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ec2573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ee691906117ce565b73ffffffffffffffffffffffffffffffffffffffff16632ddf0fa16040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f2e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f52919061180b565b610f5c8484611900565b610f669190611913565b610f709190611957565b6080840152610f7f82866118ed565b94505f955050505b5091955093505050505b935093915050565b5f805f8690505f808273ffffffffffffffffffffffffffffffffffffffff166316f0115b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fea573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061100e91906117ce565b73ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b81526004016040805180830381865afa158015611055573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061107991906117e9565b915091505f8373ffffffffffffffffffffffffffffffffffffffff1663f2d656178573ffffffffffffffffffffffffffffffffffffffff16630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156110e3573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061110791906117ce565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815273ffffffffffffffffffffffffffffffffffffffff9091166004820152602481018c90525f6044820152606401602060405180830381865afa15801561117b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061119f919061180b565b90508181111561120f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f457863657373697665207377617020616d6f756e740000000000000000000000604482015260640160405180910390fd5b61271061121c8982611900565b6112269083611913565b6112309190611957565b955061123c89846118ed565b92506112488683611900565b91505f6112578b88868661128a565b90506127106112668982611900565b6112709083611913565b61127a9190611957565b9550505050505094509492505050565b5f808590505f8673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112d9573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112fd919061180b565b9050805f0361131b576113126103e887611900565b92505050610761565b5f8273ffffffffffffffffffffffffffffffffffffffff1663ef2238166040518163ffffffff1660e01b8152600401602060405180830381865afa158015611365573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061138991906117ce565b90505f8173ffffffffffffffffffffffffffffffffffffffff1663fc02abec6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113d5573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113f9919061180b565b61140390886118ed565b90505f8273ffffffffffffffffffffffffffffffffffffffff1663a2fd92366040518163ffffffff1660e01b8152600401602060405180830381865afa15801561144f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611473919061180b565b90505f6115868a86848773ffffffffffffffffffffffffffffffffffffffff1663ea949a1c886040518263ffffffff1660e01b81526004016114b791815260200190565b602060405180830381865afa1580156114d2573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114f6919061180b565b8873ffffffffffffffffffffffffffffffffffffffff16634083902e6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561153f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611563919061180b565b61156d908e6118ed565b61157791906118ed565b6115819190611900565b611595565b9b9a5050505050505050505050565b5f838302817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff85870982811083820303915050805f036115e8578382816115de576115de61192a565b0492505050611664565b8084116115ff576115ff60038515026011186116ad565b5f848688095f868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150505b9392505050565b5f611698611678836116be565b801561169357505f848061168e5761168e61192a565b868809115b151590565b6116a3868686611595565b61075e91906118ed565b634e487b715f52806020526024601cfd5b5f60028260038111156116d3576116d361196a565b6116dd9190611997565b60ff166001149050919050565b73ffffffffffffffffffffffffffffffffffffffff8116811461170b575f80fd5b50565b5f6020828403121561171e575f80fd5b8135611664816116ea565b5f806040838503121561173a575f80fd5b8235611745816116ea565b946020939093013593505050565b5f805f8060808587031215611766575f80fd5b8435611771816116ea565b966020860135965060408601359560600135945092505050565b5f805f6060848603121561179d575f80fd5b83356117a8816116ea565b925060208401359150604084013580151581146117c3575f80fd5b809150509250925092565b5f602082840312156117de575f80fd5b8151611664816116ea565b5f80604083850312156117fa575f80fd5b505080516020909101519092909150565b5f6020828403121561181b575f80fd5b5051919050565b5f60608284031215611832575f80fd5b6040516060810181811067ffffffffffffffff8211171561187a577f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6040528251611888816116ea565b815260208301516bffffffffffffffffffffffff811681146118a8575f80fd5b60208201526040928301519281019290925250919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b808201808211156104eb576104eb6118c0565b818103818111156104eb576104eb6118c0565b80820281158282048414176104eb576104eb6118c0565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f826119655761196561192a565b500490565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b5f60ff8316806119a9576119a961192a565b8060ff8416069150509291505056fea2646970667358221220a81e492eab97cfb0cf65b38e133c44977d30c50ad2832ed674430904c4ec9f2a64736f6c63430008190033", + "nonce": "0xf1", "chainId": "0x3e7" }, "additionalContracts": [], @@ -22,25 +22,25 @@ "receipts": [ { "status": "0x1", - "cumulativeGasUsed": "0x1580c7", + "cumulativeGasUsed": "0x16a843", "logs": [], "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "type": "0x2", - "transactionHash": "0x89fad49259a188bceab20f4c327de71de707519062f3a20d55513ca52db47e7a", - "transactionIndex": "0x1", - "blockHash": "0x4275eff9897dab46113c561645411c18d0aed351d191c25d97d167fea2bdae19", - "blockNumber": "0x1d8fac", - "gasUsed": "0x139d79", - "effectiveGasPrice": "0x5f5e101", + "transactionHash": "0x08c8159d3bed3ce47c27dc466d14c8d333396f2a2403e4d7e40576a99bb6d2a5", + "transactionIndex": "0x0", + "blockHash": "0x55a9c9484994372e5526dbe77b6ee8916d66b32de56ade6e07d45386f4fc149e", + "blockNumber": "0x266ec9", + "gasUsed": "0x16a843", + "effectiveGasPrice": "0x66cc2fa", "from": "0x388e360edaac94372df1a2663ffe52671bbd8b58", "to": null, - "contractAddress": "0x68675dc8406252b6950128f6504a5e287ef24ed0" + "contractAddress": "0x7a8cc0da859103313cd6324d932c718db41b6e64" } ], "libraries": [], "pending": [], "returns": {}, - "timestamp": 1743600208, + "timestamp": 1744725720, "chain": 999, - "commit": "0f08994" + "commit": "bf56312" } \ No newline at end of file diff --git a/broadcast/STEXSwap.s.sol/999/run-latest.json b/broadcast/STEXSwap.s.sol/999/run-latest.json index 6d134a6..955107e 100644 --- a/broadcast/STEXSwap.s.sol/999/run-latest.json +++ b/broadcast/STEXSwap.s.sol/999/run-latest.json @@ -1,43 +1,43 @@ { "transactions": [ { - "hash": "0x01e3e7d33ef6093a1eb810362d72893d622652f7b150e2b7a66afcd7a52dcb8d", + "hash": "0xa07a68ce1afe11190356221167c59a6aa5c00fa65e9fae5666bb8e2e04ff9ffc", "transactionType": "CALL", "contractName": null, "contractAddress": "0xffaa4a3d97fe9107cef8a3f48c069f577ff76cc1", "function": "approve(address,uint256)", "arguments": [ "0x5365b6EF09253C7aBc0A9286eC578A9f4B413B7D", - "1000000000000000000" + "10000000000000000" ], "transaction": { "from": "0x388e360edaac94372df1a2663ffe52671bbd8b58", "to": "0xffaa4a3d97fe9107cef8a3f48c069f577ff76cc1", - "gas": "0x11408", + "gas": "0x113f7", "value": "0x0", - "input": "0x095ea7b30000000000000000000000005365b6ef09253c7abc0a9286ec578a9f4b413b7d0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "nonce": "0xc7", + "input": "0x095ea7b30000000000000000000000005365b6ef09253c7abc0a9286ec578a9f4b413b7d000000000000000000000000000000000000000000000000002386f26fc10000", + "nonce": "0xfb", "chainId": "0x3e7" }, "additionalContracts": [], "isFixedGasLimit": false }, { - "hash": "0x86e0aed687287141161d5eb9da5d38590b71bec0b91a1bb1bc0f372d74de7280", + "hash": "0xc156252d769109f65ec3bb12566019986cb12ca8936686e4ee3e913ccc106fd5", "transactionType": "CALL", "contractName": null, "contractAddress": "0x5365b6ef09253c7abc0a9286ec578a9f4b413b7d", "function": "swap((bool,bool,uint256,uint256,uint256,address,address,(bytes,bytes,bytes,bytes)))", "arguments": [ - "(false, true, 1000000000000000000, 0, 1743603346, 0x388E360eDaaC94372df1a2663FFe52671bbd8B58, 0x5555555555555555555555555555555555555555, (0x, 0x, 0x, 0x))" + "(false, true, 10000000000000000, 0, 1744917758, 0x388E360eDaaC94372df1a2663FFe52671bbd8B58, 0x5555555555555555555555555555555555555555, (0x, 0x, 0x, 0x))" ], "transaction": { "from": "0x388e360edaac94372df1a2663ffe52671bbd8b58", "to": "0x5365b6ef09253c7abc0a9286ec578a9f4b413b7d", - "gas": "0x6053f", + "gas": "0x51226", "value": "0x0", - "input": "0x373290090000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000067ed4692000000000000000000000000388e360edaac94372df1a2663ffe52671bbd8b5800000000000000000000000055555555555555555555555555555555555555550000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "nonce": "0xc8", + "input": "0x37329009000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000002386f26fc10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000680154fe000000000000000000000000388e360edaac94372df1a2663ffe52671bbd8b5800000000000000000000000055555555555555555555555555555555555555550000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0xfc", "chainId": "0x3e7" }, "additionalContracts": [], @@ -47,7 +47,7 @@ "receipts": [ { "status": "0x1", - "cumulativeGasUsed": "0x706e1", + "cumulativeGasUsed": "0x1e2dc", "logs": [ { "address": "0xffaa4a3d97fe9107cef8a3f48c069f577ff76cc1", @@ -56,31 +56,31 @@ "0x000000000000000000000000388e360edaac94372df1a2663ffe52671bbd8b58", "0x0000000000000000000000005365b6ef09253c7abc0a9286ec578a9f4b413b7d" ], - "data": "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "blockHash": "0xdc2fa85769f43fc048f87b6f96aeae0ea41557ba65dc1020ba163de3a7c34955", - "blockNumber": "0x1d95d5", - "blockTimestamp": "0x67ed463c", - "transactionHash": "0x01e3e7d33ef6093a1eb810362d72893d622652f7b150e2b7a66afcd7a52dcb8d", - "transactionIndex": "0x6", - "logIndex": "0x5", + "data": "0x000000000000000000000000000000000000000000000000002386f26fc10000", + "blockHash": "0x61903146426dc1ba703a9d4f38c543030d8293b2c3fc24e518c31713287de459", + "blockNumber": "0x27f22b", + "blockTimestamp": "0x6801549e", + "transactionHash": "0xa07a68ce1afe11190356221167c59a6aa5c00fa65e9fae5666bb8e2e04ff9ffc", + "transactionIndex": "0x2", + "logIndex": "0x2", "removed": false } ], "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000100040000000000000004000000000000000200000000000000000000000000000000000000000000000000000000100000000000200000000000000000000000050000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000040020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000", "type": "0x2", - "transactionHash": "0x01e3e7d33ef6093a1eb810362d72893d622652f7b150e2b7a66afcd7a52dcb8d", - "transactionIndex": "0x6", - "blockHash": "0xdc2fa85769f43fc048f87b6f96aeae0ea41557ba65dc1020ba163de3a7c34955", - "blockNumber": "0x1d95d5", - "gasUsed": "0xc7d8", - "effectiveGasPrice": "0x5f5e101", + "transactionHash": "0xa07a68ce1afe11190356221167c59a6aa5c00fa65e9fae5666bb8e2e04ff9ffc", + "transactionIndex": "0x2", + "blockHash": "0x61903146426dc1ba703a9d4f38c543030d8293b2c3fc24e518c31713287de459", + "blockNumber": "0x27f22b", + "gasUsed": "0xc7cc", + "effectiveGasPrice": "0x966ec72", "from": "0x388e360edaac94372df1a2663ffe52671bbd8b58", "to": "0xffaa4a3d97fe9107cef8a3f48c069f577ff76cc1", "contractAddress": null }, { "status": "0x1", - "cumulativeGasUsed": "0xb62b7", + "cumulativeGasUsed": "0xf010e", "logs": [ { "address": "0xffaa4a3d97fe9107cef8a3f48c069f577ff76cc1", @@ -89,13 +89,13 @@ "0x000000000000000000000000388e360edaac94372df1a2663ffe52671bbd8b58", "0x0000000000000000000000005365b6ef09253c7abc0a9286ec578a9f4b413b7d" ], - "data": "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "blockHash": "0xdc2fa85769f43fc048f87b6f96aeae0ea41557ba65dc1020ba163de3a7c34955", - "blockNumber": "0x1d95d5", - "blockTimestamp": "0x67ed463c", - "transactionHash": "0x86e0aed687287141161d5eb9da5d38590b71bec0b91a1bb1bc0f372d74de7280", - "transactionIndex": "0x7", - "logIndex": "0x6", + "data": "0x000000000000000000000000000000000000000000000000002386f26fc10000", + "blockHash": "0xb6645d5e6f19651348badd26a0507b28cdd90aab60f0e35eada2a7fb3968c07e", + "blockNumber": "0x27f22c", + "blockTimestamp": "0x680154a0", + "transactionHash": "0xc156252d769109f65ec3bb12566019986cb12ca8936686e4ee3e913ccc106fd5", + "transactionIndex": "0x5", + "logIndex": "0x14", "removed": false }, { @@ -105,13 +105,13 @@ "0x0000000000000000000000005365b6ef09253c7abc0a9286ec578a9f4b413b7d", "0x00000000000000000000000039694eff3b02248929120c73f90347013aec834d" ], - "data": "0x0000000000000000000000000000000000000000000000000002d4b26cdb5cd0", - "blockHash": "0xdc2fa85769f43fc048f87b6f96aeae0ea41557ba65dc1020ba163de3a7c34955", - "blockNumber": "0x1d95d5", - "blockTimestamp": "0x67ed463c", - "transactionHash": "0x86e0aed687287141161d5eb9da5d38590b71bec0b91a1bb1bc0f372d74de7280", - "transactionIndex": "0x7", - "logIndex": "0x7", + "data": "0x0000000000000000000000000000000000000000000000000000002e8fbcaad0", + "blockHash": "0xb6645d5e6f19651348badd26a0507b28cdd90aab60f0e35eada2a7fb3968c07e", + "blockNumber": "0x27f22c", + "blockTimestamp": "0x680154a0", + "transactionHash": "0xc156252d769109f65ec3bb12566019986cb12ca8936686e4ee3e913ccc106fd5", + "transactionIndex": "0x5", + "logIndex": "0x15", "removed": false }, { @@ -121,13 +121,13 @@ "0x0000000000000000000000005365b6ef09253c7abc0a9286ec578a9f4b413b7d", "0x000000000000000000000000388e360edaac94372df1a2663ffe52671bbd8b58" ], - "data": "0x0000000000000000000000000000000000000000000000000dd28f37871b2fef", - "blockHash": "0xdc2fa85769f43fc048f87b6f96aeae0ea41557ba65dc1020ba163de3a7c34955", - "blockNumber": "0x1d95d5", - "blockTimestamp": "0x67ed463c", - "transactionHash": "0x86e0aed687287141161d5eb9da5d38590b71bec0b91a1bb1bc0f372d74de7280", - "transactionIndex": "0x7", - "logIndex": "0x8", + "data": "0x00000000000000000000000000000000000000000000000000238609a111a9f0", + "blockHash": "0xb6645d5e6f19651348badd26a0507b28cdd90aab60f0e35eada2a7fb3968c07e", + "blockNumber": "0x27f22c", + "blockTimestamp": "0x680154a0", + "transactionHash": "0xc156252d769109f65ec3bb12566019986cb12ca8936686e4ee3e913ccc106fd5", + "transactionIndex": "0x5", + "logIndex": "0x16", "removed": false }, { @@ -136,24 +136,24 @@ "0x176648f1f11cda284c124490086be42a926ddf0ae887ebe7b1d6b337d8942756", "0x000000000000000000000000388e360edaac94372df1a2663ffe52671bbd8b58" ], - "data": "0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000e277c2048d0110000000000000000000000000000000000000000000000000dd28f37871b2fef", - "blockHash": "0xdc2fa85769f43fc048f87b6f96aeae0ea41557ba65dc1020ba163de3a7c34955", - "blockNumber": "0x1d95d5", - "blockTimestamp": "0x67ed463c", - "transactionHash": "0x86e0aed687287141161d5eb9da5d38590b71bec0b91a1bb1bc0f372d74de7280", - "transactionIndex": "0x7", - "logIndex": "0x9", + "data": "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000002386f26fc10000000000000000000000000000000000000000000000000000000000e8ceaf561000000000000000000000000000000000000000000000000000238609a111a9f0", + "blockHash": "0xb6645d5e6f19651348badd26a0507b28cdd90aab60f0e35eada2a7fb3968c07e", + "blockNumber": "0x27f22c", + "blockTimestamp": "0x680154a0", + "transactionHash": "0xc156252d769109f65ec3bb12566019986cb12ca8936686e4ee3e913ccc106fd5", + "transactionIndex": "0x5", + "logIndex": "0x17", "removed": false } ], "logsBloom": "0x00000000000000000000000001000000000001000000000000000000000000000000000000000000000000100040000000000000004000000000000000000000000000000000000000000008000000000000000000000000000100000000000200000000000000000000000050000000000000000000000008000010001000000000000000000000080000000000000000000000000000000000020000000040000000000000000000000010000000000000000020000000100000000000004000000022000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000020000000000000000000000000", "type": "0x2", - "transactionHash": "0x86e0aed687287141161d5eb9da5d38590b71bec0b91a1bb1bc0f372d74de7280", - "transactionIndex": "0x7", - "blockHash": "0xdc2fa85769f43fc048f87b6f96aeae0ea41557ba65dc1020ba163de3a7c34955", - "blockNumber": "0x1d95d5", - "gasUsed": "0x45bd6", - "effectiveGasPrice": "0x5f5e101", + "transactionHash": "0xc156252d769109f65ec3bb12566019986cb12ca8936686e4ee3e913ccc106fd5", + "transactionIndex": "0x5", + "blockHash": "0xb6645d5e6f19651348badd26a0507b28cdd90aab60f0e35eada2a7fb3968c07e", + "blockNumber": "0x27f22c", + "gasUsed": "0x3abd7", + "effectiveGasPrice": "0x882328f", "from": "0x388e360edaac94372df1a2663ffe52671bbd8b58", "to": "0x5365b6ef09253c7abc0a9286ec578a9f4b413b7d", "contractAddress": null @@ -162,7 +162,7 @@ "libraries": [], "pending": [], "returns": {}, - "timestamp": 1743603261, + "timestamp": 1744917665, "chain": 999, - "commit": "0f08994" + "commit": "bf56312" } \ No newline at end of file diff --git a/propose_withdrawal_module.sh b/propose_withdrawal_module.sh new file mode 100644 index 0000000..c3abea3 --- /dev/null +++ b/propose_withdrawal_module.sh @@ -0,0 +1 @@ +eval $(grep '^RPC_URL' .env) && forge script scripts/WithdrawalModuleProposal.s.sol:WithdrawalModuleProposalScript --rpc-url $RPC_URL \ No newline at end of file diff --git a/scripts/LendingModuleProposal.s.sol b/scripts/LendingModuleProposal.s.sol index bd73a29..e7731e0 100644 --- a/scripts/LendingModuleProposal.s.sol +++ b/scripts/LendingModuleProposal.s.sol @@ -4,6 +4,8 @@ pragma solidity ^0.8.25; import "forge-std/Script.sol"; import {Test} from "forge-std/Test.sol"; +import {ISovereignPool} from "@valantis-core/pools/interfaces/ISovereignPool.sol"; + import {AaveLendingModule} from "src/AaveLendingModule.sol"; import {STEXAMM} from "src/STEXAMM.sol"; import {stHYPEWithdrawalModule} from "src/stHYPEWithdrawalModule.sol"; @@ -26,7 +28,7 @@ contract LendingModuleProposalScript is Script, Test { address protocolFactory = 0x7E028ac56cB2AF75292F3D967978189698C24732; stHYPEWithdrawalModule withdrawalModule = stHYPEWithdrawalModule( - payable(0x40Ba056B004Edd0b572509A1276Fd8530cf2bb7f) + payable(0x69e487aA3132708d08a979b2d07c5119Bb77F698) ); STEXAMM stex = STEXAMM( @@ -34,8 +36,8 @@ contract LendingModuleProposalScript is Script, Test { ); assertEq(stex.owner(), ownerMultisig); - address pool = stex.pool(); - console.log("STEX sovereign pool: ", pool); + ISovereignPool pool = ISovereignPool(stex.pool()); + console.log("STEX sovereign pool: ", address(pool)); console.log("STEX AMM: ", address(stex)); @@ -51,14 +53,13 @@ contract LendingModuleProposalScript is Script, Test { assertEq(manager.keeper(), address(keeper)); AaveLendingModule lendingModule = AaveLendingModule( - 0x36baFeB0f12A13Ca579ED4080D95AC74f59e98e0 + 0xf2CE1b504205557e9Ae700Ea480Ce2d633430be1 ); // Simulate proposal - assertEq(lendingModule.assetBalance(), 0); - //vm.startPrank(address(manager)); - /*withdrawalModule.proposeLendingModule(address(lendingModule), 3 days); + /*vm.startPrank(address(manager)); + withdrawalModule.proposeLendingModule(address(lendingModule), 3 days); ( address lendingModuleProposed, uint256 startTimestamp @@ -66,17 +67,39 @@ contract LendingModuleProposalScript is Script, Test { assertEq(lendingModuleProposed, address(lendingModule)); assertEq(startTimestamp, block.timestamp + 3 days); - vm.warp(block.timestamp + 3 days);*/ + vm.warp(block.timestamp + 3 days); - /*withdrawalModule.setProposedLendingModule(); + withdrawalModule.setProposedLendingModule(); assertEq( address(withdrawalModule.lendingModule()), address(lendingModule) ); + vm.stopPrank(); - withdrawalModule.supplyToken1ToLendingPool(10 ether); - assertEq(lendingModule.assetBalance(), 10 ether);*/ - //vm.stopPrank(); + // Simulate lending module deposit + vm.startPrank(address(manager)); + withdrawalModule.supplyToken1ToLendingPool(20_000 ether); + console.log( + "asset balance in lending protocol: ", + lendingModule.assetBalance() + ); + vm.stopPrank(); + + // Simulate lending module withdraw + vm.startPrank(address(manager)); + (uint256 preReserve0, uint256 preReserve1) = pool.getReserves(); + withdrawalModule.withdrawToken1FromLendingPool( + 20_000 ether, + address(0) + ); + console.log( + "asset balance in lending protocol: ", + lendingModule.assetBalance() + ); + (uint256 reserve0, uint256 reserve1) = pool.getReserves(); + assertEq(reserve0, preReserve0); + assertGe(reserve1, preReserve1 + 20_000 ether); + vm.stopPrank();*/ // Generate payload for `proposeLendingModule` /*vm.startPrank(ownerMultisig); @@ -106,7 +129,7 @@ contract LendingModuleProposalScript is Script, Test { vm.stopPrank();*/ // Generate payload for `setProposedLendingModule` - vm.startPrank(ownerMultisig); + /*vm.startPrank(ownerMultisig); bytes memory payload = abi.encodeWithSelector( stHYPEWithdrawalModule.setProposedLendingModule.selector @@ -125,11 +148,8 @@ contract LendingModuleProposalScript is Script, Test { assertEq( address(withdrawalModule.lendingModule()), address(lendingModule) - ); + );*/ vm.stopPrank(); - - //withdrawalModule.supplyToken1ToLendingPool(10 ether); - //assertEq(lendingModule.assetBalance(), 10 ether); } } diff --git a/scripts/OverseerInteractions.s.sol b/scripts/OverseerInteractions.s.sol index 7d6f812..db081d4 100644 --- a/scripts/OverseerInteractions.s.sol +++ b/scripts/OverseerInteractions.s.sol @@ -25,7 +25,7 @@ contract OverseerInteractionsScript is Script, Test { ); IWithdrawalModule withdrawalModule = IWithdrawalModule( - 0xc7267F6cc4B4f61a025A797ef03c11285E6b630C + 0x69e487aA3132708d08a979b2d07c5119Bb77F698 ); uint256[] memory burnIds = overseer.getBurnIds( diff --git a/scripts/STEXDeploy.s.sol b/scripts/STEXDeploy.s.sol index 98b2490..430cd02 100644 --- a/scripts/STEXDeploy.s.sol +++ b/scripts/STEXDeploy.s.sol @@ -43,17 +43,26 @@ contract STEXDeployScript is Script, Test { ); assertEq(swapFeeModule.owner(), deployerAddress);*/ STEXRatioSwapFeeModule swapFeeModule = STEXRatioSwapFeeModule( - 0x69317CEcf77Fb5dc68aBE5C7aAfB283De46956d9 + 0x18cdf91aF34E44D4B4CF5e86b31B42BD86569418 ); + // Uncomment to generate payload to propose Swap Fee Module update under timelock + /*bytes memory swapFeeModuleProposalPayload = abi.encodeWithSelector( + STEXAMM.proposeSwapFeeModule.selector, + address(swapFeeModule), + 3 days + ); + console.log("payload for swap fee module proposal: "); + console.logBytes(swapFeeModuleProposalPayload);*/ + // Uncomment to transfer ownership of Swap Fee Module //swapFeeModule.transferOwnership(ownerMultisig); assertEq(swapFeeModule.owner(), ownerMultisig); // Uncomment to set Swap Fee Module params /*{ - uint32 minThresholdRatioBips = 3_000; - uint32 maxThresholdRatioBips = 7_000; - uint32 feeMinBips = 5; - uint32 feeMaxBips = 40; + uint32 minThresholdRatioBips = 4_000; + uint32 maxThresholdRatioBips = 9_500; + uint32 feeMinBips = 1; + uint32 feeMaxBips = 1; bytes memory payload = abi.encodeWithSelector( STEXRatioSwapFeeModule.setSwapFeeParams.selector, @@ -66,12 +75,14 @@ contract STEXDeployScript is Script, Test { console.log("payload for swapFeeModule.setSwapFeeParams: "); console.logBytes(payload); - // swapFeeModule.setSwapFeeParams( - // minThresholdRatioBips, - // maxThresholdRatioBips, - // feeMinBips, - // feeMaxBips - // ); + vm.startPrank(ownerMultisig); + swapFeeModule.setSwapFeeParams( + minThresholdRatioBips, + maxThresholdRatioBips, + feeMinBips, + feeMaxBips + ); + vm.stopPrank(); }*/ /*{ ( @@ -80,10 +91,10 @@ contract STEXDeployScript is Script, Test { uint32 feeMinBips, uint32 feeMaxBips ) = swapFeeModule.feeParams(); - assertEq(minThresholdRatioBips, 3_000); - assertEq(maxThresholdRatioBips, 7_000); - assertEq(feeMinBips, 5); - assertEq(feeMaxBips, 40); + assertEq(minThresholdRatioBips, 4_000); + assertEq(maxThresholdRatioBips, 9_500); + assertEq(feeMinBips, 1); + assertEq(feeMaxBips, 1); }*/ // Uncomment for deployment of Withdrawal Module @@ -94,7 +105,7 @@ contract STEXDeployScript is Script, Test { assertEq(withdrawalModule.owner(), deployerAddress); assertEq(withdrawalModule.overseer(), overseer);*/ stHYPEWithdrawalModule withdrawalModule = stHYPEWithdrawalModule( - payable(0x40Ba056B004Edd0b572509A1276Fd8530cf2bb7f) + payable(0x69e487aA3132708d08a979b2d07c5119Bb77F698) ); // Uncomment for deployment of STEX AMM diff --git a/scripts/STEXLensDeploy.s.sol b/scripts/STEXLensDeploy.s.sol index 5aaec4a..b5911bf 100644 --- a/scripts/STEXLensDeploy.s.sol +++ b/scripts/STEXLensDeploy.s.sol @@ -17,10 +17,10 @@ contract STEXLensDeployScript is Script, Test { vm.startBroadcast(deployerPrivateKey); // Uncomment to deploy STEX Lens - address stexLens = address(new STEXLens()); - /*STEXLens stexLens = STEXLens( + //address stexLens = address(new STEXLens()); + STEXLens stexLens = STEXLens( 0x40FeebdE4e98BbD31c07698A89d545482ff29E82 - );*/ + ); vm.stopBroadcast(); } diff --git a/scripts/STEXSwap.s.sol b/scripts/STEXSwap.s.sol index e351267..3032c1e 100644 --- a/scripts/STEXSwap.s.sol +++ b/scripts/STEXSwap.s.sol @@ -32,7 +32,7 @@ contract STEXSwapScript is Script, Test { address token1 = stex.token1(); address tokenIn = token0; - uint256 amount = 1 ether; + uint256 amount = 0.01 ether; uint256 amountOut = stex.getAmountOut(tokenIn, amount, false); diff --git a/scripts/WithdrawalModuleProposal.s.sol b/scripts/WithdrawalModuleProposal.s.sol new file mode 100644 index 0000000..2046c93 --- /dev/null +++ b/scripts/WithdrawalModuleProposal.s.sol @@ -0,0 +1,186 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.25; + +import "forge-std/Script.sol"; +import {Test} from "forge-std/Test.sol"; + +import {ISovereignPool} from "@valantis-core/pools/interfaces/ISovereignPool.sol"; + +import {STEXAMM} from "src/STEXAMM.sol"; +import {stHYPEWithdrawalModule} from "src/stHYPEWithdrawalModule.sol"; +import {WithdrawalModuleManager} from "src/owner/WithdrawalModuleManager.sol"; +import {WithdrawalModuleKeeper} from "src/owner/WithdrawalModuleKeeper.sol"; + +contract WithdrawalModuleProposalScript is Script, Test { + function run() external { + uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PRIVATE_KEY"); + address deployerAddress = vm.addr(deployerPrivateKey); + + if (block.chainid != 999) revert("Chain ID not Hyper EVM mainnet"); + + console.log("Deployer address: ", deployerAddress); + + //vm.startBroadcast(deployerPrivateKey); + + // Address of owner multi-sig wallet + address ownerMultisig = 0xe26dA5cBf101bDA4028E2B3208c32424f5D09421; + + // stHYPE + address token0 = 0xfFaa4a3D97fE9107Cef8a3F48c069F577Ff76cC1; + // WHYPE + address token1 = 0x5555555555555555555555555555555555555555; + + // Valantis Protocol Factory + address protocolFactory = 0x7E028ac56cB2AF75292F3D967978189698C24732; + + // Thunderhead's Overseer + address overseer = 0xB96f07367e69e86d6e9C3F29215885104813eeAE; + + // Previous deployment of withdrawal module (after proposal gets executed) + stHYPEWithdrawalModule withdrawalModuleOld = stHYPEWithdrawalModule( + payable(0x40Ba056B004Edd0b572509A1276Fd8530cf2bb7f) + ); + + // Uncomment for deployment of Withdrawal Module + /*stHYPEWithdrawalModule withdrawalModule = new stHYPEWithdrawalModule( + overseer, + deployerAddress + ); + assertEq(withdrawalModule.owner(), deployerAddress); + assertEq(withdrawalModule.overseer(), overseer);*/ + stHYPEWithdrawalModule withdrawalModule = stHYPEWithdrawalModule( + payable(0x69e487aA3132708d08a979b2d07c5119Bb77F698) + ); + + STEXAMM stex = STEXAMM( + payable(0x39694eFF3b02248929120c73F90347013Aec834d) + ); + assertEq(stex.owner(), ownerMultisig); + + ISovereignPool pool = ISovereignPool(stex.pool()); + + vm.startPrank(ownerMultisig); + + // Uncomment to set STEX AMM in withdrawal module + /*withdrawalModule.setSTEX(address(stex)); + assertEq(withdrawalModule.stex(), address(stex)); + assertEq(withdrawalModule.pool(), address(pool));*/ + + // Uncomment to propose the new withdrawal module + /*bytes memory payload = abi.encodeWithSelector( + STEXAMM.proposeWithdrawalModule.selector, + address(withdrawalModule) + ); + console.log("payload for stex.proposeWithdrawalModule: "); + console.logBytes(payload); + + stex.proposeWithdrawalModule(address(withdrawalModule)); + (address swapFeeModuleNew, uint256 timestamp) = stex + .withdrawalModuleProposal(); + assertEq(swapFeeModuleNew, address(withdrawalModule)); + assertEq(timestamp, block.timestamp + 7 days);*/ + + // Uncomment to update to the new withdrawal module after timelock + // Ensure that all token1 is sent back to the pool before applying the proposal + /*assertLt( + withdrawalModuleOld.amountToken1LendingPool(), + 1e16, + "Must withdraw token1 from old withdrawal module's lending pool" + ); + // Ensure that all pending LP withdrawals from old module are processed + assertEq( + withdrawalModuleOld.amountToken1PendingLPWithdrawal(), + 0, + "There are pending LP withdrawals in old withdrawal module" + ); + assertEq(withdrawalModuleOld.amountToken0PendingUnstaking(), 0); + // Ensure that `update` does not need to be called + assertEq( + address(withdrawalModuleOld).balance, + withdrawalModuleOld.amountToken1ClaimableLPWithdrawal(), + "Need to call update in old withdrawal module" + ); + + bytes memory payloadSetWithdrawalModule = abi.encodeWithSelector( + STEXAMM.setProposedWithdrawalModule.selector + ); + console.log("payload for stex.setProposedWithdrawalModule"); + console.logBytes(payloadSetWithdrawalModule);*/ + + //vm.warp(block.timestamp + 7 days); + //stex.setProposedWithdrawalModule(); + assertEq(stex.withdrawalModule(), address(withdrawalModule)); + + vm.stopPrank(); + + WithdrawalModuleKeeper keeper = WithdrawalModuleKeeper( + 0x0Aef1eAAd539C16292faEB16D3F4AB5842F0aa6c + ); + assertEq(keeper.owner(), ownerMultisig); + + WithdrawalModuleManager manager = WithdrawalModuleManager( + 0x80c7f89398160fCD9E74519f63F437459E5d02E2 + ); + assertEq(manager.owner(), ownerMultisig); + assertEq(manager.keeper(), address(keeper)); + + // Uncomment to transfer ownership of withdrawal module to manager contract + //withdrawalModule.transferOwnership(address(manager)); + assertEq(withdrawalModule.owner(), address(manager)); + + // Uncomment to test withdrawal module's `stakeToken1` + /*vm.startPrank(ownerMultisig); + + (uint256 preReserve0, uint256 preReserve1) = pool.getReserves(); + uint256 amountToStake = 50_000 ether; + string memory communityCode = "0x6e616e73656e"; + bytes memory payloadStakeToken1 = abi.encodeWithSelector( + stHYPEWithdrawalModule.stakeToken1.selector, + amountToStake, + communityCode + ); + bytes memory managerPayload = abi.encodeWithSelector( + WithdrawalModuleManager.call.selector, + address(withdrawalModule), + payloadStakeToken1 + ); + console.log( + "payload to withdrawalModule manager for withdrawalModule.stakeToken1: " + ); + console.logBytes(managerPayload); + + (bool success, ) = address(manager).call(managerPayload); + assertTrue(success); + + (uint256 postReserve0, uint256 postReserve1) = pool.getReserves(); + assertEq(postReserve0, preReserve0 + amountToStake); + assertEq(postReserve1, preReserve1 - amountToStake); + + vm.stopPrank();*/ + + // Uncomment for deployment of Aave Lending Module + /*{ + AaveLendingModule lendingModule = new AaveLendingModule( + 0xceCcE0EB9DD2Ef7996e01e25DD70e461F918A14b, // AAVE V3 pool + 0x7C97cd7B57b736c6AD74fAE97C0e21e856251dcf, // aWHYPE + stex.token1(), // WHYPE + address(withdrawalModule), // owner + ownerMultisig, // tokenSweepManager + 2 + ); + assertEq( + address(lendingModule.pool()), + 0xceCcE0EB9DD2Ef7996e01e25DD70e461F918A14b + ); + assertEq( + lendingModule.yieldToken(), + 0x7C97cd7B57b736c6AD74fAE97C0e21e856251dcf + ); + assertEq(lendingModule.owner(), address(withdrawalModule)); + assertEq(lendingModule.tokenSweepManager(), ownerMultisig); + assertEq(lendingModule.referralCode(), 2); + }*/ + + //vm.stopBroadcast(); + } +} diff --git a/scripts/WithdrawalModuleStaking.s.sol b/scripts/WithdrawalModuleStaking.s.sol new file mode 100644 index 0000000..02e21ed --- /dev/null +++ b/scripts/WithdrawalModuleStaking.s.sol @@ -0,0 +1,85 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.25; + +import "forge-std/Script.sol"; +import {Test} from "forge-std/Test.sol"; + +import {ISovereignPool} from "@valantis-core/pools/interfaces/ISovereignPool.sol"; + +import {STEXAMM} from "src/STEXAMM.sol"; +import {stHYPEWithdrawalModule} from "src/stHYPEWithdrawalModule.sol"; +import {WithdrawalModuleManager} from "src/owner/WithdrawalModuleManager.sol"; +import {WithdrawalModuleKeeper} from "src/owner/WithdrawalModuleKeeper.sol"; + +contract WithdrawalModuleStakingScript is Script, Test { + function run() external { + uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PRIVATE_KEY"); + address deployerAddress = vm.addr(deployerPrivateKey); + + if (block.chainid != 999) revert("Chain ID not Hyper EVM mainnet"); + + console.log("Deployer address: ", deployerAddress); + + //vm.startBroadcast(deployerPrivateKey); + + // Address of owner multi-sig wallet + address ownerMultisig = 0xe26dA5cBf101bDA4028E2B3208c32424f5D09421; + + stHYPEWithdrawalModule withdrawalModule = stHYPEWithdrawalModule( + payable(0x69e487aA3132708d08a979b2d07c5119Bb77F698) + ); + + STEXAMM stex = STEXAMM( + payable(0x39694eFF3b02248929120c73F90347013Aec834d) + ); + assertEq(stex.owner(), ownerMultisig); + + ISovereignPool pool = ISovereignPool(stex.pool()); + + assertEq(stex.withdrawalModule(), address(withdrawalModule)); + + WithdrawalModuleKeeper keeper = WithdrawalModuleKeeper( + 0x0Aef1eAAd539C16292faEB16D3F4AB5842F0aa6c + ); + assertEq(keeper.owner(), ownerMultisig); + + WithdrawalModuleManager manager = WithdrawalModuleManager( + 0x80c7f89398160fCD9E74519f63F437459E5d02E2 + ); + assertEq(manager.owner(), ownerMultisig); + assertEq(manager.keeper(), address(keeper)); + assertEq(withdrawalModule.owner(), address(manager)); + + // Uncomment to test withdrawal module's `stakeToken1` + /*vm.startPrank(ownerMultisig); + + (uint256 preReserve0, uint256 preReserve1) = pool.getReserves(); + uint256 amountToStake = 12_000 ether; + string memory communityCode = "0x6e616e73656e"; + bytes memory payloadStakeToken1 = abi.encodeWithSelector( + stHYPEWithdrawalModule.stakeToken1.selector, + amountToStake, + communityCode + ); + bytes memory managerPayload = abi.encodeWithSelector( + WithdrawalModuleManager.call.selector, + address(withdrawalModule), + payloadStakeToken1 + ); + console.log( + "payload to withdrawalModule manager for withdrawalModule.stakeToken1: " + ); + console.logBytes(managerPayload); + + (bool success, ) = address(manager).call(managerPayload); + assertTrue(success); + + (uint256 postReserve0, uint256 postReserve1) = pool.getReserves(); + assertEq(postReserve0, preReserve0 + amountToStake); + assertEq(postReserve1, preReserve1 - amountToStake); + + vm.stopPrank();*/ + + //vm.stopBroadcast(); + } +} diff --git a/src/DepositWrapper.sol b/src/DepositWrapper.sol index 2100a06..8500542 100644 --- a/src/DepositWrapper.sol +++ b/src/DepositWrapper.sol @@ -1,8 +1,11 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.25; -import {Address} from "@openzeppelin/contracts/utils/Address.sol"; +import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; +import {ReentrancyGuardTransient} from "@openzeppelin/contracts/utils/ReentrancyGuardTransient.sol"; +import {ISovereignPool} from "@valantis-core/pools/interfaces/ISovereignPool.sol"; +import {SovereignPoolSwapParams} from "@valantis-core/pools/structs/SovereignPoolStructs.sol"; import {IWETH9} from "./interfaces/IWETH9.sol"; import {ISTEXAMM} from "./interfaces/ISTEXAMM.sol"; @@ -10,7 +13,8 @@ import {ISTEXAMM} from "./interfaces/ISTEXAMM.sol"; /** * @notice Native token wrapper to deposit into Stake Exchange AMM. */ -contract DepositWrapper { +contract DepositWrapper is ReentrancyGuardTransient { + using SafeERC20 for ERC20; using SafeERC20 for IWETH9; /** @@ -67,6 +71,7 @@ contract DepositWrapper { function depositFromNative(uint256 _minShares, uint256 _deadline, address _recipient) external payable + nonReentrant returns (uint256 shares) { if (_recipient == address(0)) revert DepositWrapper__ZeroAddress(); @@ -79,6 +84,48 @@ contract DepositWrapper { shares = stex.deposit(amount, _minShares, _deadline, _recipient); } + /** + * @notice Helper function which swaps token0 into token1, and then deposits into STEX AMM. + * @param _amountToken0 Amount of token0 to swap. + * @param _amountToken1Min Minimum amount of token1 required after swap. + * @param _minShares Minimum amount of LP token required. + * @param _deadline Block timestamp after which this call expires. + * @param _recipient Address to mint LP tokens for. + * @return shares Amount of LP tokens minted during deposit. + */ + function depositFromToken0( + uint256 _amountToken0, + uint256 _amountToken1Min, + uint256 _minShares, + uint256 _deadline, + address _recipient + ) external nonReentrant returns (uint256 shares) { + if (_recipient == address(0)) revert DepositWrapper__ZeroAddress(); + + if (_amountToken0 == 0) return 0; + + ERC20 token0 = ERC20(stex.token0()); + token0.safeTransferFrom(msg.sender, address(this), _amountToken0); + // WARNING: Do not donate tokens into this contract! + uint256 amountToken0 = token0.balanceOf(address(this)); + + ISovereignPool pool = ISovereignPool(stex.pool()); + + token0.forceApprove(address(pool), amountToken0); + SovereignPoolSwapParams memory swapParams; + swapParams.isZeroToOne = true; + swapParams.amountIn = amountToken0; + swapParams.amountOutMin = _amountToken1Min; + swapParams.deadline = _deadline; + swapParams.swapTokenOut = address(weth); + swapParams.recipient = address(this); + + (, uint256 amountToken1) = pool.swap(swapParams); + + weth.forceApprove(address(stex), amountToken1); + shares = stex.deposit(amountToken1, _minShares, _deadline, _recipient); + } + /** * * PRIVATE FUNCTIONS diff --git a/src/STEXLens.sol b/src/STEXLens.sol index 07a1417..c8492a7 100644 --- a/src/STEXLens.sol +++ b/src/STEXLens.sol @@ -65,25 +65,40 @@ contract STEXLens { function getSharesForDeposit(address stex, uint256 amount) external view returns (uint256) { ISTEXAMM stexInterface = ISTEXAMM(stex); - uint256 totalSupplyCache = ERC20(stex).totalSupply(); - if (totalSupplyCache == 0) { - return amount - MINIMUM_LIQUIDITY; - } - IWithdrawalModule withdrawalModule = IWithdrawalModule(stexInterface.withdrawalModule()); (uint256 reserve0Pool, uint256 reserve1Pool) = ISovereignPool(stexInterface.pool()).getReserves(); - // Account for token0 in pool (liquid) and pending unstaking (locked) - uint256 reserve0Total = reserve0Pool + withdrawalModule.amountToken0PendingUnstaking(); - // Account for token1 pending withdrawal to LPs (locked) - uint256 reserve1PendingWithdrawal = withdrawalModule.amountToken1PendingLPWithdrawal(); - // shares calculated in terms of token1 - uint256 shares = Math.mulDiv( - amount, - totalSupplyCache, - reserve1Pool + withdrawalModule.amountToken1LendingPool() + withdrawalModule.convertToToken1(reserve0Total) - - reserve1PendingWithdrawal - ); + return _getSharesForDeposit(stex, amount, reserve0Pool, reserve1Pool); + } - return shares; + function getSharesForDepositAndPoolReserves( + address stex, + uint256 amount, + uint256 reserve0Pool, + uint256 reserve1Pool + ) external view returns (uint256) { + return _getSharesForDeposit(stex, amount, reserve0Pool, reserve1Pool); + } + + function getMinAmountsForToken0Deposit( + address stex, + uint256 amountToken0, + uint256 slippageSwapBips, + uint256 slippageDepositBips + ) external view returns (uint256 amountToken1Min, uint256 minShares) { + ISTEXAMM stexInterface = ISTEXAMM(stex); + + (uint256 reserve0Pool, uint256 reserve1Pool) = ISovereignPool(stexInterface.pool()).getReserves(); + + uint256 amountToken1 = stexInterface.getAmountOut(stexInterface.token0(), amountToken0, false); + require(amountToken1 <= reserve1Pool, "Excessive swap amount"); + + amountToken1Min = (amountToken1 * (BIPS - slippageSwapBips)) / BIPS; + + reserve0Pool += amountToken0; + reserve1Pool -= amountToken1Min; + + uint256 shares = _getSharesForDeposit(stex, amountToken1Min, reserve0Pool, reserve1Pool); + + minShares = (shares * (BIPS - slippageDepositBips)) / BIPS; } function getAmountsForWithdraw(address stex, uint256 shares, bool isInstantWithdrawal) @@ -183,4 +198,35 @@ contract STEXLens { return true; } + + /** + * + * PRIVATE FUNCTIONS + * + */ + function _getSharesForDeposit(address stex, uint256 amount, uint256 reserve0Pool, uint256 reserve1Pool) + private + view + returns (uint256) + { + ISTEXAMM stexInterface = ISTEXAMM(stex); + uint256 totalSupplyCache = ERC20(stex).totalSupply(); + if (totalSupplyCache == 0) { + return amount - MINIMUM_LIQUIDITY; + } + IWithdrawalModule withdrawalModule = IWithdrawalModule(stexInterface.withdrawalModule()); + // Account for token0 in pool (liquid) and pending unstaking (locked) + uint256 reserve0Total = reserve0Pool + withdrawalModule.amountToken0PendingUnstaking(); + // Account for token1 pending withdrawal to LPs (locked) + uint256 reserve1PendingWithdrawal = withdrawalModule.amountToken1PendingLPWithdrawal(); + // shares calculated in terms of token1 + uint256 shares = Math.mulDiv( + amount, + totalSupplyCache, + reserve1Pool + withdrawalModule.amountToken1LendingPool() + withdrawalModule.convertToToken1(reserve0Total) + - reserve1PendingWithdrawal + ); + + return shares; + } } diff --git a/src/STEXRatioSwapFeeModule.sol b/src/STEXRatioSwapFeeModule.sol index af5c248..9ce102d 100644 --- a/src/STEXRatioSwapFeeModule.sol +++ b/src/STEXRatioSwapFeeModule.sol @@ -24,8 +24,6 @@ contract STEXRatioSwapFeeModule is ISTEXRatioSwapFeeModule, Ownable { error STEXRatioSwapFeeModule__setSwapFeeParams_inconsistentFeeParams(); error STEXRatioSwapFeeModule__setSwapFeeParams_invalidFeeMin(); error STEXRatioSwapFeeModule__setSwapFeeParams_invalidFeeMax(); - error STEXRatioSwapFeeModule__setSwapFeeParams_invalidMinThresholdRatio(); - error STEXRatioSwapFeeModule__setSwapFeeParams_invalidMaxThresholdRatio(); error STEXRatioSwapFeeModule__setSwapFeeParams_inconsistentThresholdRatioParams(); error STEXRatioSwapFeeModule__setPool_alreadySet(); @@ -158,13 +156,6 @@ contract STEXRatioSwapFeeModule is ISTEXRatioSwapFeeModule, Ownable { uint32 _feeMinBips, uint32 _feeMaxBips ) external override onlyOwner { - // Reserve ratio threshold params must be in BIPS - if (_minThresholdRatioBips >= BIPS) { - revert STEXRatioSwapFeeModule__setSwapFeeParams_invalidMinThresholdRatio(); - } - if (_maxThresholdRatioBips > BIPS) { - revert STEXRatioSwapFeeModule__setSwapFeeParams_invalidMaxThresholdRatio(); - } if (_minThresholdRatioBips >= _maxThresholdRatioBips) { revert STEXRatioSwapFeeModule__setSwapFeeParams_inconsistentThresholdRatioParams(); } diff --git a/src/interfaces/IOverseer.sol b/src/interfaces/IOverseer.sol index c0644da..a34346c 100644 --- a/src/interfaces/IOverseer.sol +++ b/src/interfaces/IOverseer.sol @@ -2,6 +2,8 @@ pragma solidity ^0.8.25; interface IOverseer { + function mint(address to, string memory communityCode) external payable returns (uint256); + function burnAndRedeemIfPossible(address to, uint256 amount, string memory communityCode) external returns (uint256 burnId); diff --git a/src/interfaces/IWithdrawalModule.sol b/src/interfaces/IWithdrawalModule.sol index 9544aff..cc1f44a 100644 --- a/src/interfaces/IWithdrawalModule.sol +++ b/src/interfaces/IWithdrawalModule.sol @@ -15,10 +15,14 @@ interface IWithdrawalModule { function amountToken0PendingUnstaking() external view returns (uint256); + function amountToken0PendingUnstakingBeforeUpdate() external view returns (uint256); + function amountToken1LendingPool() external view returns (uint256); function amountToken1PendingLPWithdrawal() external view returns (uint256); + function amountToken1PendingLPWithdrawalBeforeUpdate() external view returns (uint256); + function amountToken1ClaimableLPWithdrawal() external view returns (uint256); function cumulativeAmountToken1LPWithdrawal() external view returns (uint256); diff --git a/src/mocks/MockOverseer.sol b/src/mocks/MockOverseer.sol index e00da3c..c1257df 100644 --- a/src/mocks/MockOverseer.sol +++ b/src/mocks/MockOverseer.sol @@ -3,6 +3,8 @@ pragma solidity ^0.8.25; import {IOverseer} from "../interfaces/IOverseer.sol"; +import {MockStHype} from "./MockStHype.sol"; + contract MockOverseer is IOverseer { struct Burn { address to; @@ -13,6 +15,12 @@ contract MockOverseer is IOverseer { mapping(uint256 => Burn) public burnsById; + MockStHype public mockStHype; + + constructor(address _mockStHype) { + mockStHype = MockStHype(payable(_mockStHype)); + } + receive() external payable {} function getBurnIds(address /*account*/ ) external pure override returns (uint256[] memory) { @@ -25,6 +33,11 @@ contract MockOverseer is IOverseer { return false; } + function mint(address to, string memory /*communityCode*/ ) external payable override returns (uint256) { + mockStHype.mint{value: msg.value}(to); + return msg.value; + } + function burnAndRedeemIfPossible(address to, uint256 amount, string memory /*_communityCode*/ ) external override diff --git a/src/stHYPEWithdrawalModule.sol b/src/stHYPEWithdrawalModule.sol index 2508873..d0bb59a 100644 --- a/src/stHYPEWithdrawalModule.sol +++ b/src/stHYPEWithdrawalModule.sol @@ -38,8 +38,11 @@ contract stHYPEWithdrawalModule is IWithdrawalModule, ReentrancyGuardTransient, event LendingModuleProposed(address lendingModule, uint256 startTimestamp); event LendingModuleProposalCancelled(); event LendingModuleSet(address lendingModule); + event AmountToken1Staked(uint256 amount); + event AmountToken0Unstaked(uint256 amount); event AmountSuppliedToLendingModule(uint256 amount); event AmountWithdrawnFromLendingModule(uint256 amount); + event Update(); /** * @@ -136,15 +139,15 @@ contract stHYPEWithdrawalModule is IWithdrawalModule, ReentrancyGuardTransient, /** * @notice Amount of `token0` pending unstaking in the `overseer` withdrawal queue. - * @dev This will change as excess native token balance gets added to this contract. + * @dev This might get updated after calling to `update`. */ uint256 private _amountToken0PendingUnstaking; /** * @notice Amount of native `token1` which is owed to STEX AMM LPs who have burnt their LP tokens. - * @dev This will change as excess native token balance gets added to this contract. + * @dev This might get updated after calling to `update`. */ - uint256 public _amountToken1PendingLPWithdrawal; + uint256 private _amountToken1PendingLPWithdrawal; /** * @@ -258,6 +261,14 @@ contract stHYPEWithdrawalModule is IWithdrawalModule, ReentrancyGuardTransient, } } + /** + * @notice Similar to `amountToken0PendingUnstaking()`, + * but returns the value in storage prior to calling `update`. + */ + function amountToken0PendingUnstakingBeforeUpdate() external view override returns (uint256) { + return _amountToken0PendingUnstaking; + } + /** * @notice Tracks amount of token1 which is owed to LP withdrawal requests. * @dev This needs to be tracked as a function of surplus native token balance in this contract, @@ -274,6 +285,14 @@ contract stHYPEWithdrawalModule is IWithdrawalModule, ReentrancyGuardTransient, } } + /** + * @notice Similar to `amountToken1PendingLPWithdrawal()`, + * but returns the value in storage prior to calling `update`. + */ + function amountToken1PendingLPWithdrawalBeforeUpdate() external view override returns (uint256) { + return _amountToken1PendingLPWithdrawal; + } + /** * @notice Returns amount of token1 owned in the lending module. */ @@ -327,6 +346,7 @@ contract stHYPEWithdrawalModule is IWithdrawalModule, ReentrancyGuardTransient, lendingModuleProposal = LendingModuleProposal({lendingModule: _lendingModule, startTimestamp: block.timestamp + _timelockDelay}); + emit LendingModuleProposed(_lendingModule, block.timestamp + _timelockDelay); } @@ -336,6 +356,7 @@ contract stHYPEWithdrawalModule is IWithdrawalModule, ReentrancyGuardTransient, */ function cancelLendingModuleProposal() external onlyOwner { emit LendingModuleProposalCancelled(); + delete lendingModuleProposal; } @@ -435,14 +456,42 @@ contract stHYPEWithdrawalModule is IWithdrawalModule, ReentrancyGuardTransient, if (postBalance - preBalance < _amountToken1) { revert stHYPEWithdrawalModule__withdrawToken1FromLendingPool_insufficientAmountWithdrawn(); } + emit AmountWithdrawnFromLendingModule(_amountToken1); } + /** + * @notice Withdraws a portion of pool's token1 reserves and stakes into `overseer` for an equivalent amount of `token0`. + * @dev Only callable by `owner`. + * @param _amountToken1 Amount of pool's token1 reserves to stake into token0. + * @param _communityCode Community code for `overseer` mint function. + */ + function stakeToken1(uint256 _amountToken1, string memory _communityCode) + external + onlyOwner + whenPoolNotLocked + nonReentrant + { + if (_amountToken1 == 0) return; + + ISTEXAMM stexInterface = ISTEXAMM(stex); + stexInterface.supplyToken1Reserves(_amountToken1); + + // Unwrap into native token + address token1Address = stexInterface.token1(); + IWETH9(token1Address).withdraw(_amountToken1); + + IOverseer(overseer).mint{value: _amountToken1}(pool, _communityCode); + + emit AmountToken1Staked(_amountToken1); + } + /** * @notice Withdraws a portion of pool's token1 reserves and supplies to `lendingPool` to earn extra yield. * @dev Only callable by `owner`. + * @param _amountToken1 Amount of token1 reserves to supply. */ - function supplyToken1ToLendingPool(uint256 _amountToken1) external onlyOwner nonReentrant { + function supplyToken1ToLendingPool(uint256 _amountToken1) external override onlyOwner nonReentrant { if (address(lendingModule) == address(0)) return; if (_amountToken1 == 0) return; @@ -454,6 +503,7 @@ contract stHYPEWithdrawalModule is IWithdrawalModule, ReentrancyGuardTransient, IWETH9(token1).forceApprove(address(lendingModule), _amountToken1); // WARNING: Assumes that lending module deposits the total `_amountToken1` (no partial deposits) lendingModule.deposit(_amountToken1); + emit AmountSuppliedToLendingModule(_amountToken1); } @@ -475,6 +525,8 @@ contract stHYPEWithdrawalModule is IWithdrawalModule, ReentrancyGuardTransient, // WARNING: This implementation assumes that there is no slashing enabled in the LST protocol ERC20(token0).forceApprove(overseer, amountToken0); IOverseer(overseer).burnAndRedeemIfPossible(address(this), amountToken0, ""); + + emit AmountToken0Unstaked(amountToken0); } /** @@ -520,6 +572,8 @@ contract stHYPEWithdrawalModule is IWithdrawalModule, ReentrancyGuardTransient, // Pool reserves are measured as balances, hence we can replenish it with token1 // by transfering directly token1.safeTransfer(pool, excessNativeBalance); + + emit Update(); } /** diff --git a/test/AaveLendingModule.t.sol b/test/AaveLendingModule.t.sol index 5265c46..e2f3d94 100644 --- a/test/AaveLendingModule.t.sol +++ b/test/AaveLendingModule.t.sol @@ -49,6 +49,9 @@ contract AaveLendingModuleTest is Test { vm.startPrank(tokenSweepManager); + vm.expectRevert(AaveLendingModule.AaveLendingModule__ZeroAddress.selector); + lendingModule.setTokenSweepManager(address(0)); + lendingModule.setTokenSweepManager(newTokenSweepManager); assertEq(lendingModule.tokenSweepManager(), newTokenSweepManager); diff --git a/test/STEXAMM.t.sol b/test/STEXAMM.t.sol index 3bcd24f..bd634e5 100644 --- a/test/STEXAMM.t.sol +++ b/test/STEXAMM.t.sol @@ -54,16 +54,16 @@ contract STEXAMMTest is Test { ISovereignPool pool; function setUp() public { - overseer = new MockOverseer(); + token0 = new MockStHype(); + weth = new WETH(); + + overseer = new MockOverseer(address(token0)); protocolFactory = new ProtocolFactory(address(this)); address sovereignPoolFactory = address(new SovereignPoolFactory()); protocolFactory.setSovereignPoolFactory(sovereignPoolFactory); - token0 = new MockStHype(); - weth = new WETH(); - stexLens = new STEXLens(); lendingPool = new MockLendingPool(address(weth)); @@ -465,6 +465,7 @@ contract STEXAMMTest is Test { function testSetSwapFeeParams() public { _setSwapFeeParams(1000, 7000, 1, 20); + _setSwapFeeParams(11_000, 200_000, 1, 4999); } function _setSwapFeeParams( @@ -478,16 +479,6 @@ contract STEXAMMTest is Test { vm.startPrank(owner); - vm.expectRevert( - STEXRatioSwapFeeModule.STEXRatioSwapFeeModule__setSwapFeeParams_invalidMinThresholdRatio.selector - ); - swapFeeModule.setSwapFeeParams(10_000, maxThresholdRatioBips, feeMinBips, feeMaxBips); - - vm.expectRevert( - STEXRatioSwapFeeModule.STEXRatioSwapFeeModule__setSwapFeeParams_invalidMaxThresholdRatio.selector - ); - swapFeeModule.setSwapFeeParams(minThresholdRatioBips, 10_000 + 1, feeMinBips, feeMaxBips); - vm.expectRevert( STEXRatioSwapFeeModule.STEXRatioSwapFeeModule__setSwapFeeParams_inconsistentThresholdRatioParams.selector ); @@ -572,6 +563,9 @@ contract STEXAMMTest is Test { // Test normal deposit sharesSimulation = stexLens.getSharesForDeposit(address(stex), amount); + uint256 sharesSimulation2 = + stexLens.getSharesForDepositAndPoolReserves(address(stex), amount, reserve0, reserve1); + assertEq(sharesSimulation, sharesSimulation2); shares = stex.deposit(amount, 0, block.timestamp, recipient); assertEq(shares, sharesSimulation); assertEq(stex.balanceOf(address(1)), 1e3); @@ -614,6 +608,44 @@ contract STEXAMMTest is Test { assertEq(preReserve1 + amount, postReserve1); } + function testDeposit__FromToken0() public { + testDeposit(); + + // AMM swap fee as 1 bips + _setSwapFeeParams(3000, 5000, 1, 1); + + address recipient = makeAddr("MOCK_RECIPIENT_FROM_TOKEN0"); + + token0.mint{value: 1 ether}(recipient); + + vm.startPrank(recipient); + + uint256 amountToken0 = 1 ether; + token0.approve(address(nativeWrapper), amountToken0); + + vm.expectRevert(DepositWrapper.DepositWrapper__ZeroAddress.selector); + nativeWrapper.depositFromToken0(amountToken0, amountToken0, 0, block.timestamp, address(0)); + + // No state updates + nativeWrapper.depositFromToken0(0, 0, 0, block.timestamp, recipient); + assertEq(stex.balanceOf(recipient), 0); + + vm.expectRevert(bytes("Excessive swap amount")); + stexLens.getMinAmountsForToken0Deposit(address(stex), 2 * amountToken0, 0, 0); + + (uint256 amountToken1Min, uint256 minShares) = + stexLens.getMinAmountsForToken0Deposit(address(stex), amountToken0, 0, 0); + + uint256 shares = + nativeWrapper.depositFromToken0(amountToken0, amountToken1Min, minShares, block.timestamp, recipient); + assertEq(token0.balanceOf(address(nativeWrapper)), 0); + assertEq(weth.balanceOf(address(nativeWrapper)), 0); + assertEq(stex.balanceOf(recipient), minShares); + assertEq(stex.balanceOf(recipient), shares); + + vm.stopPrank(); + } + function testDeposit__WithUpdate() public { assertFalse(stex.isLocked()); diff --git a/test/stHYPEWithdrawalModule.t.sol b/test/stHYPEWithdrawalModule.t.sol index 0c7429f..ba1daad 100644 --- a/test/stHYPEWithdrawalModule.t.sol +++ b/test/stHYPEWithdrawalModule.t.sol @@ -46,11 +46,11 @@ contract stHYPEWithdrawalModuleTest is Test { function setUp() public { stexLens = new STEXLens(); - overseer = new MockOverseer(); - _token0 = new MockStHype(); weth = new WETH(); + overseer = new MockOverseer(address(_token0)); + _pool = address(new MockPool()); lendingPool = new MockLendingPool(address(weth)); @@ -154,6 +154,34 @@ contract stHYPEWithdrawalModuleTest is Test { assertEq(_withdrawalModule.token0SharesToBalance(shares), amount0); } + function testStakeAmount1() public { + assertFalse(_withdrawalModule.isLocked()); + + string memory communityCode = "valantis"; + + vm.expectRevert(abi.encodeWithSelector(Ownable.OwnableUnauthorizedAccount.selector, address(this))); + _withdrawalModule.stakeToken1(1 ether, communityCode); + + vm.startPrank(owner); + + // No state updates + _withdrawalModule.stakeToken1(0, communityCode); + + // Cannot be called when Sovereign Pool is locked, to prevent read-only reentrancy + MockPool(_pool).setIsLocked(true); + vm.expectRevert(stHYPEWithdrawalModule.stHYPEWithdrawalModule__PoolNonReentrant.selector); + _withdrawalModule.stakeToken1(1 ether, communityCode); + MockPool(_pool).setIsLocked(false); + + assertEq(_token0.balanceOf(_pool), 0); + uint256 preToken1Balance = weth.balanceOf(address(this)); + _withdrawalModule.stakeToken1(1 ether, communityCode); + assertEq(weth.balanceOf(address(this)), preToken1Balance - 1 ether); + assertEq(_token0.balanceOf(_pool), 1 ether); + + vm.stopPrank(); + } + function testAmountToken1LendingPool() public { assertFalse(_withdrawalModule.isLocked()); @@ -303,13 +331,23 @@ contract stHYPEWithdrawalModuleTest is Test { assertEq(amountToken1PendingLPWithdrawal, _withdrawalModule.convertToToken1(1 ether)); vm.deal(address(_withdrawalModule), 0.5 ether); + assertEq(_withdrawalModule.amountToken0PendingUnstakingBeforeUpdate(), 3 ether); + assertEq(_withdrawalModule.amountToken1PendingLPWithdrawalBeforeUpdate(), 1 ether); _withdrawalModule.update(); assertEq( _withdrawalModule.amountToken0PendingUnstaking(), 3 ether - _withdrawalModule.convertToToken0(0.5 ether) ); + assertEq( + _withdrawalModule.amountToken0PendingUnstaking(), + _withdrawalModule.amountToken0PendingUnstakingBeforeUpdate() + ); assertEq(_withdrawalModule.amountToken1ClaimableLPWithdrawal(), 0.5 ether); assertEq(_withdrawalModule.amountToken1PendingLPWithdrawal(), amountToken1PendingLPWithdrawal - 0.5 ether); + assertEq( + _withdrawalModule.amountToken1PendingLPWithdrawal(), + _withdrawalModule.amountToken1PendingLPWithdrawalBeforeUpdate() + ); assertEq(address(_withdrawalModule).balance, 0.5 ether); // Not enough ETH left to re-deposit into pool assertEq(weth.balanceOf(_pool), 0); diff --git a/withdrawal_module_stake.sh b/withdrawal_module_stake.sh new file mode 100644 index 0000000..c4949b4 --- /dev/null +++ b/withdrawal_module_stake.sh @@ -0,0 +1 @@ +eval $(grep '^RPC_URL' .env) && forge script scripts/WithdrawalModuleStaking.s.sol:WithdrawalModuleStakingScript --rpc-url $RPC_URL \ No newline at end of file