2 Commits

Author SHA1 Message Date
tim
54c76be2f0 sepolia redeploy 2025-11-11 13:20:23 -04:00
tim
2fa2a05459 bin/gas-report 2025-11-11 12:46:58 -04:00
23 changed files with 132 additions and 87 deletions

19
bin/gas-report Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
report() {
REPORT=$(forge test --mc GasTest --mt "$1" --gas-report)
SWAP=$(echo "$REPORT" | grep 'swap ' | cut -d '|' -f 5 | xargs)
MINT=$(echo "$REPORT" | grep 'mint ' | cut -d '|' -f 5 | xargs)
SWAPMINT=$(echo "$REPORT" | grep 'swapMint ' | cut -d '|' -f 5 | xargs)
printf "%-10s %10s %10s %10s\n" "$1" "$SWAP" "$MINT" "$SWAPMINT"
}
# Print header
printf "%-10s %10s %10s %10s\n" "" "swap" "mint" "swapMint"
printf "%s\n" " ------ --------- ---------"
report GasPair
report StablePair
report Ten
report Twenty
report Fifty

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
{"abi":[],"bytecode":{"object":"0x6080806040523460175760399081601c823930815050f35b5f80fdfe5f80fdfea2646970667358221220b3e7e7d176c75fd687d50408cdd3f2f0c44423e17a0f674e797ffbe7fae0105564736f6c634300081e0033","sourceMap":"552:41522:42:-:0;;;;;;;;;;;;;;;;;;;;;","linkReferences":{}},"deployedBytecode":{"object":"0x5f80fdfea2646970667358221220b3e7e7d176c75fd687d50408cdd3f2f0c44423e17a0f674e797ffbe7fae0105564736f6c634300081e0033","sourceMap":"552:41522:42:-:0;;","linkReferences":{}},"methodIdentifiers":{},"rawMetadata":"{\"compiler\":{\"version\":\"0.8.30+commit.73712a01\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"notice\":\"Stabilized LMSR library with incremental exp(z) caching for gas efficiency. - Stores b (64.64), M (shift), Z = sum exp(z_i), z[i] = (q_i / b) - M - Caches e[i] = exp(z[i]) so we avoid recomputing exp() for every asset on each trade. - Provides closed-form \\u0394C on deposit, amount-out for asset->asset, and incremental applyDeposit/applyWithdraw that update e[i] and Z in O(1).\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/LMSRStabilized.sol\":\"LMSRStabilized\"},\"evmVersion\":\"prague\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":100000000},\"remappings\":[\":@abdk/=lib/abdk-libraries-solidity/\",\":@openzeppelin/=lib/openzeppelin-contracts/\",\":abdk-libraries-solidity/=lib/abdk-libraries-solidity/\",\":erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/\",\":forge-std/=lib/forge-std/src/\",\":halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/\",\":openzeppelin-contracts/=lib/openzeppelin-contracts/\"],\"viaIR\":true},\"sources\":{\"lib/abdk-libraries-solidity/ABDKMath64x64.sol\":{\"keccak256\":\"0x1364fdc24192b982f647c7fc68dcb2f6fc1b5e201843e773144bd23a76cb3b97\",\"license\":\"BSD-4-Clause\",\"urls\":[\"bzz-raw://490712cc07db32f274899b17aade9c975f06010848c21500b8a5ead6898e09c7\",\"dweb:/ipfs/QmZMPKjDgwCFSGdLWJW6g5E7hDLByA9hNjXzAwJ4GKTZvN\"]},\"src/LMSRStabilized.sol\":{\"keccak256\":\"0xb3df5a014bbb48a1aea62faee4ef9c7a830fcb0209cf1304bdca4fa68126a3f3\",\"license\":\"UNLICENSED\",\"urls\":[\"bzz-raw://b05b0c09bb8883fed3c03509bf6f5f9991435ae6648530662b4fd01f667ab955\",\"dweb:/ipfs/QmeYVgnoXn3uiZdUsW2TYigfRPuHBR7AV1fpRm6uT9Z1gZ\"]}},\"version\":1}","metadata":{"compiler":{"version":"0.8.30+commit.73712a01"},"language":"Solidity","output":{"abi":[],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"remappings":["@abdk/=lib/abdk-libraries-solidity/","@openzeppelin/=lib/openzeppelin-contracts/","abdk-libraries-solidity/=lib/abdk-libraries-solidity/","erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/","forge-std/=lib/forge-std/src/","halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/","openzeppelin-contracts/=lib/openzeppelin-contracts/"],"optimizer":{"enabled":true,"runs":100000000},"metadata":{"bytecodeHash":"ipfs"},"compilationTarget":{"src/LMSRStabilized.sol":"LMSRStabilized"},"evmVersion":"prague","libraries":{},"viaIR":true},"sources":{"lib/abdk-libraries-solidity/ABDKMath64x64.sol":{"keccak256":"0x1364fdc24192b982f647c7fc68dcb2f6fc1b5e201843e773144bd23a76cb3b97","urls":["bzz-raw://490712cc07db32f274899b17aade9c975f06010848c21500b8a5ead6898e09c7","dweb:/ipfs/QmZMPKjDgwCFSGdLWJW6g5E7hDLByA9hNjXzAwJ4GKTZvN"],"license":"BSD-4-Clause"},"src/LMSRStabilized.sol":{"keccak256":"0xb3df5a014bbb48a1aea62faee4ef9c7a830fcb0209cf1304bdca4fa68126a3f3","urls":["bzz-raw://b05b0c09bb8883fed3c03509bf6f5f9991435ae6648530662b4fd01f667ab955","dweb:/ipfs/QmeYVgnoXn3uiZdUsW2TYigfRPuHBR7AV1fpRm6uT9Z1gZ"],"license":"UNLICENSED"}},"version":1},"id":42}
{"abi":[],"bytecode":{"object":"0x6080806040523460175760399081601c823930815050f35b5f80fdfe5f80fdfea264697066735822122043a81c5a8112d10309d1ad8e6f619479e20ed7226ff1858199395f0823c2442864736f6c634300081e0033","sourceMap":"552:41558:42:-:0;;;;;;;;;;;;;;;;;;;;;","linkReferences":{}},"deployedBytecode":{"object":"0x5f80fdfea264697066735822122043a81c5a8112d10309d1ad8e6f619479e20ed7226ff1858199395f0823c2442864736f6c634300081e0033","sourceMap":"552:41558:42:-:0;;","linkReferences":{}},"methodIdentifiers":{},"rawMetadata":"{\"compiler\":{\"version\":\"0.8.30+commit.73712a01\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"notice\":\"Stabilized LMSR library with incremental exp(z) caching for gas efficiency. - Stores b (64.64), M (shift), Z = sum exp(z_i), z[i] = (q_i / b) - M - Caches e[i] = exp(z[i]) so we avoid recomputing exp() for every asset on each trade. - Provides closed-form \\u0394C on deposit, amount-out for asset->asset, and incremental applyDeposit/applyWithdraw that update e[i] and Z in O(1).\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/LMSRStabilized.sol\":\"LMSRStabilized\"},\"evmVersion\":\"prague\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":100000000},\"remappings\":[\":@abdk/=lib/abdk-libraries-solidity/\",\":@openzeppelin/=lib/openzeppelin-contracts/\",\":abdk-libraries-solidity/=lib/abdk-libraries-solidity/\",\":erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/\",\":forge-std/=lib/forge-std/src/\",\":halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/\",\":openzeppelin-contracts/=lib/openzeppelin-contracts/\"],\"viaIR\":true},\"sources\":{\"lib/abdk-libraries-solidity/ABDKMath64x64.sol\":{\"keccak256\":\"0x1364fdc24192b982f647c7fc68dcb2f6fc1b5e201843e773144bd23a76cb3b97\",\"license\":\"BSD-4-Clause\",\"urls\":[\"bzz-raw://490712cc07db32f274899b17aade9c975f06010848c21500b8a5ead6898e09c7\",\"dweb:/ipfs/QmZMPKjDgwCFSGdLWJW6g5E7hDLByA9hNjXzAwJ4GKTZvN\"]},\"src/LMSRStabilized.sol\":{\"keccak256\":\"0x0a242f1378f609f0af4a2d9686287b33a7279fb987df0db43705f417b46ab68b\",\"license\":\"UNLICENSED\",\"urls\":[\"bzz-raw://b9f834fcccf2e080fb5578afbe34dc3d8ac02b3f3364e0c2224bf30dcb32c1f3\",\"dweb:/ipfs/QmdN7rT5AnGNTyiHC22mYpxkk6T7cmjEkFgtcJvGM3roLB\"]}},\"version\":1}","metadata":{"compiler":{"version":"0.8.30+commit.73712a01"},"language":"Solidity","output":{"abi":[],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"remappings":["@abdk/=lib/abdk-libraries-solidity/","@openzeppelin/=lib/openzeppelin-contracts/","abdk-libraries-solidity/=lib/abdk-libraries-solidity/","erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/","forge-std/=lib/forge-std/src/","halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/","openzeppelin-contracts/=lib/openzeppelin-contracts/"],"optimizer":{"enabled":true,"runs":100000000},"metadata":{"bytecodeHash":"ipfs"},"compilationTarget":{"src/LMSRStabilized.sol":"LMSRStabilized"},"evmVersion":"prague","libraries":{},"viaIR":true},"sources":{"lib/abdk-libraries-solidity/ABDKMath64x64.sol":{"keccak256":"0x1364fdc24192b982f647c7fc68dcb2f6fc1b5e201843e773144bd23a76cb3b97","urls":["bzz-raw://490712cc07db32f274899b17aade9c975f06010848c21500b8a5ead6898e09c7","dweb:/ipfs/QmZMPKjDgwCFSGdLWJW6g5E7hDLByA9hNjXzAwJ4GKTZvN"],"license":"BSD-4-Clause"},"src/LMSRStabilized.sol":{"keccak256":"0x0a242f1378f609f0af4a2d9686287b33a7279fb987df0db43705f417b46ab68b","urls":["bzz-raw://b9f834fcccf2e080fb5578afbe34dc3d8ac02b3f3364e0c2224bf30dcb32c1f3","dweb:/ipfs/QmdN7rT5AnGNTyiHC22mYpxkk6T7cmjEkFgtcJvGM3roLB"],"license":"UNLICENSED"}},"version":1},"id":42}

View File

@@ -1 +1 @@
{"abi":[],"bytecode":{"object":"0x6080806040523460175760399081601c823930815050f35b5f80fdfe5f80fdfea26469706673582212203b495f7bb157deb0060a295e9dac267b9d7e9e99d58b6b261eb376f830bcfe5864736f6c634300081e0033","sourceMap":"265:8588:43:-:0;;;;;;;;;;;;;;;;;;;;;","linkReferences":{}},"deployedBytecode":{"object":"0x5f80fdfea26469706673582212203b495f7bb157deb0060a295e9dac267b9d7e9e99d58b6b261eb376f830bcfe5864736f6c634300081e0033","sourceMap":"265:8588:43:-:0;;","linkReferences":{}},"methodIdentifiers":{},"rawMetadata":"{\"compiler\":{\"version\":\"0.8.30+commit.73712a01\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"notice\":\"Specialized functions for the 2-asset stablecoin case\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/LMSRStabilizedBalancedPair.sol\":\"LMSRStabilizedBalancedPair\"},\"evmVersion\":\"prague\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":100000000},\"remappings\":[\":@abdk/=lib/abdk-libraries-solidity/\",\":@openzeppelin/=lib/openzeppelin-contracts/\",\":abdk-libraries-solidity/=lib/abdk-libraries-solidity/\",\":erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/\",\":forge-std/=lib/forge-std/src/\",\":halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/\",\":openzeppelin-contracts/=lib/openzeppelin-contracts/\"],\"viaIR\":true},\"sources\":{\"lib/abdk-libraries-solidity/ABDKMath64x64.sol\":{\"keccak256\":\"0x1364fdc24192b982f647c7fc68dcb2f6fc1b5e201843e773144bd23a76cb3b97\",\"license\":\"BSD-4-Clause\",\"urls\":[\"bzz-raw://490712cc07db32f274899b17aade9c975f06010848c21500b8a5ead6898e09c7\",\"dweb:/ipfs/QmZMPKjDgwCFSGdLWJW6g5E7hDLByA9hNjXzAwJ4GKTZvN\"]},\"src/LMSRStabilized.sol\":{\"keccak256\":\"0xb3df5a014bbb48a1aea62faee4ef9c7a830fcb0209cf1304bdca4fa68126a3f3\",\"license\":\"UNLICENSED\",\"urls\":[\"bzz-raw://b05b0c09bb8883fed3c03509bf6f5f9991435ae6648530662b4fd01f667ab955\",\"dweb:/ipfs/QmeYVgnoXn3uiZdUsW2TYigfRPuHBR7AV1fpRm6uT9Z1gZ\"]},\"src/LMSRStabilizedBalancedPair.sol\":{\"keccak256\":\"0x782f3baf92f74152c0b93b95199abbb3a36c75c921454260c8b0237f91d7c59d\",\"license\":\"UNLICENSED\",\"urls\":[\"bzz-raw://04d463c4fdcb6c8e2ebf9aed649ff21cca759ba73a4c93659e30c7df25e26c81\",\"dweb:/ipfs/QmUxmWytiw5VYJRUrFbSGm1oWmDPQ4q23pnkmK1q9P4apN\"]}},\"version\":1}","metadata":{"compiler":{"version":"0.8.30+commit.73712a01"},"language":"Solidity","output":{"abi":[],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"remappings":["@abdk/=lib/abdk-libraries-solidity/","@openzeppelin/=lib/openzeppelin-contracts/","abdk-libraries-solidity/=lib/abdk-libraries-solidity/","erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/","forge-std/=lib/forge-std/src/","halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/","openzeppelin-contracts/=lib/openzeppelin-contracts/"],"optimizer":{"enabled":true,"runs":100000000},"metadata":{"bytecodeHash":"ipfs"},"compilationTarget":{"src/LMSRStabilizedBalancedPair.sol":"LMSRStabilizedBalancedPair"},"evmVersion":"prague","libraries":{},"viaIR":true},"sources":{"lib/abdk-libraries-solidity/ABDKMath64x64.sol":{"keccak256":"0x1364fdc24192b982f647c7fc68dcb2f6fc1b5e201843e773144bd23a76cb3b97","urls":["bzz-raw://490712cc07db32f274899b17aade9c975f06010848c21500b8a5ead6898e09c7","dweb:/ipfs/QmZMPKjDgwCFSGdLWJW6g5E7hDLByA9hNjXzAwJ4GKTZvN"],"license":"BSD-4-Clause"},"src/LMSRStabilized.sol":{"keccak256":"0xb3df5a014bbb48a1aea62faee4ef9c7a830fcb0209cf1304bdca4fa68126a3f3","urls":["bzz-raw://b05b0c09bb8883fed3c03509bf6f5f9991435ae6648530662b4fd01f667ab955","dweb:/ipfs/QmeYVgnoXn3uiZdUsW2TYigfRPuHBR7AV1fpRm6uT9Z1gZ"],"license":"UNLICENSED"},"src/LMSRStabilizedBalancedPair.sol":{"keccak256":"0x782f3baf92f74152c0b93b95199abbb3a36c75c921454260c8b0237f91d7c59d","urls":["bzz-raw://04d463c4fdcb6c8e2ebf9aed649ff21cca759ba73a4c93659e30c7df25e26c81","dweb:/ipfs/QmUxmWytiw5VYJRUrFbSGm1oWmDPQ4q23pnkmK1q9P4apN"],"license":"UNLICENSED"}},"version":1},"id":43}
{"abi":[],"bytecode":{"object":"0x6080806040523460175760399081601c823930815050f35b5f80fdfe5f80fdfea26469706673582212207b738d2a73692c4ef9caa0271e6969b1039466e2d67d251b700fd148ddd9dc3e64736f6c634300081e0033","sourceMap":"265:8588:43:-:0;;;;;;;;;;;;;;;;;;;;;","linkReferences":{}},"deployedBytecode":{"object":"0x5f80fdfea26469706673582212207b738d2a73692c4ef9caa0271e6969b1039466e2d67d251b700fd148ddd9dc3e64736f6c634300081e0033","sourceMap":"265:8588:43:-:0;;","linkReferences":{}},"methodIdentifiers":{},"rawMetadata":"{\"compiler\":{\"version\":\"0.8.30+commit.73712a01\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"notice\":\"Specialized functions for the 2-asset stablecoin case\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/LMSRStabilizedBalancedPair.sol\":\"LMSRStabilizedBalancedPair\"},\"evmVersion\":\"prague\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":100000000},\"remappings\":[\":@abdk/=lib/abdk-libraries-solidity/\",\":@openzeppelin/=lib/openzeppelin-contracts/\",\":abdk-libraries-solidity/=lib/abdk-libraries-solidity/\",\":erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/\",\":forge-std/=lib/forge-std/src/\",\":halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/\",\":openzeppelin-contracts/=lib/openzeppelin-contracts/\"],\"viaIR\":true},\"sources\":{\"lib/abdk-libraries-solidity/ABDKMath64x64.sol\":{\"keccak256\":\"0x1364fdc24192b982f647c7fc68dcb2f6fc1b5e201843e773144bd23a76cb3b97\",\"license\":\"BSD-4-Clause\",\"urls\":[\"bzz-raw://490712cc07db32f274899b17aade9c975f06010848c21500b8a5ead6898e09c7\",\"dweb:/ipfs/QmZMPKjDgwCFSGdLWJW6g5E7hDLByA9hNjXzAwJ4GKTZvN\"]},\"src/LMSRStabilized.sol\":{\"keccak256\":\"0x0a242f1378f609f0af4a2d9686287b33a7279fb987df0db43705f417b46ab68b\",\"license\":\"UNLICENSED\",\"urls\":[\"bzz-raw://b9f834fcccf2e080fb5578afbe34dc3d8ac02b3f3364e0c2224bf30dcb32c1f3\",\"dweb:/ipfs/QmdN7rT5AnGNTyiHC22mYpxkk6T7cmjEkFgtcJvGM3roLB\"]},\"src/LMSRStabilizedBalancedPair.sol\":{\"keccak256\":\"0x782f3baf92f74152c0b93b95199abbb3a36c75c921454260c8b0237f91d7c59d\",\"license\":\"UNLICENSED\",\"urls\":[\"bzz-raw://04d463c4fdcb6c8e2ebf9aed649ff21cca759ba73a4c93659e30c7df25e26c81\",\"dweb:/ipfs/QmUxmWytiw5VYJRUrFbSGm1oWmDPQ4q23pnkmK1q9P4apN\"]}},\"version\":1}","metadata":{"compiler":{"version":"0.8.30+commit.73712a01"},"language":"Solidity","output":{"abi":[],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"remappings":["@abdk/=lib/abdk-libraries-solidity/","@openzeppelin/=lib/openzeppelin-contracts/","abdk-libraries-solidity/=lib/abdk-libraries-solidity/","erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/","forge-std/=lib/forge-std/src/","halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/","openzeppelin-contracts/=lib/openzeppelin-contracts/"],"optimizer":{"enabled":true,"runs":100000000},"metadata":{"bytecodeHash":"ipfs"},"compilationTarget":{"src/LMSRStabilizedBalancedPair.sol":"LMSRStabilizedBalancedPair"},"evmVersion":"prague","libraries":{},"viaIR":true},"sources":{"lib/abdk-libraries-solidity/ABDKMath64x64.sol":{"keccak256":"0x1364fdc24192b982f647c7fc68dcb2f6fc1b5e201843e773144bd23a76cb3b97","urls":["bzz-raw://490712cc07db32f274899b17aade9c975f06010848c21500b8a5ead6898e09c7","dweb:/ipfs/QmZMPKjDgwCFSGdLWJW6g5E7hDLByA9hNjXzAwJ4GKTZvN"],"license":"BSD-4-Clause"},"src/LMSRStabilized.sol":{"keccak256":"0x0a242f1378f609f0af4a2d9686287b33a7279fb987df0db43705f417b46ab68b","urls":["bzz-raw://b9f834fcccf2e080fb5578afbe34dc3d8ac02b3f3364e0c2224bf30dcb32c1f3","dweb:/ipfs/QmdN7rT5AnGNTyiHC22mYpxkk6T7cmjEkFgtcJvGM3roLB"],"license":"UNLICENSED"},"src/LMSRStabilizedBalancedPair.sol":{"keccak256":"0x782f3baf92f74152c0b93b95199abbb3a36c75c921454260c8b0237f91d7c59d","urls":["bzz-raw://04d463c4fdcb6c8e2ebf9aed649ff21cca759ba73a4c93659e30c7df25e26c81","dweb:/ipfs/QmUxmWytiw5VYJRUrFbSGm1oWmDPQ4q23pnkmK1q9P4apN"],"license":"UNLICENSED"}},"version":1},"id":43}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
{"abi":[],"bytecode":{"object":"0x","sourceMap":"","linkReferences":{}},"deployedBytecode":{"object":"0x","sourceMap":"","linkReferences":{}},"methodIdentifiers":{},"rawMetadata":"{\"compiler\":{\"version\":\"0.8.30+commit.73712a01\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/PartyPoolHelpers.sol\":\"PartyPoolHelpers\"},\"evmVersion\":\"prague\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":100000000},\"remappings\":[\":@abdk/=lib/abdk-libraries-solidity/\",\":@openzeppelin/=lib/openzeppelin-contracts/\",\":abdk-libraries-solidity/=lib/abdk-libraries-solidity/\",\":erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/\",\":forge-std/=lib/forge-std/src/\",\":halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/\",\":openzeppelin-contracts/=lib/openzeppelin-contracts/\"],\"viaIR\":true},\"sources\":{\"lib/abdk-libraries-solidity/ABDKMath64x64.sol\":{\"keccak256\":\"0x1364fdc24192b982f647c7fc68dcb2f6fc1b5e201843e773144bd23a76cb3b97\",\"license\":\"BSD-4-Clause\",\"urls\":[\"bzz-raw://490712cc07db32f274899b17aade9c975f06010848c21500b8a5ead6898e09c7\",\"dweb:/ipfs/QmZMPKjDgwCFSGdLWJW6g5E7hDLByA9hNjXzAwJ4GKTZvN\"]},\"src/PartyPoolHelpers.sol\":{\"keccak256\":\"0xd43b635d12b6684ae38a685eea4bc5783cebb3696514d8aafe3f4ce34f5e759c\",\"license\":\"UNLICENSED\",\"urls\":[\"bzz-raw://832046b365d443c4c1c715f98fe3de224e3ba82c67960053d51e6a79847c4af5\",\"dweb:/ipfs/QmZ4nWMwyYQzaBGF7rBE73GYTs4z3DRNYL1ZrGAsxN6RfP\"]}},\"version\":1}","metadata":{"compiler":{"version":"0.8.30+commit.73712a01"},"language":"Solidity","output":{"abi":[],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"remappings":["@abdk/=lib/abdk-libraries-solidity/","@openzeppelin/=lib/openzeppelin-contracts/","abdk-libraries-solidity/=lib/abdk-libraries-solidity/","erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/","forge-std/=lib/forge-std/src/","halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/","openzeppelin-contracts/=lib/openzeppelin-contracts/"],"optimizer":{"enabled":true,"runs":100000000},"metadata":{"bytecodeHash":"ipfs"},"compilationTarget":{"src/PartyPoolHelpers.sol":"PartyPoolHelpers"},"evmVersion":"prague","libraries":{},"viaIR":true},"sources":{"lib/abdk-libraries-solidity/ABDKMath64x64.sol":{"keccak256":"0x1364fdc24192b982f647c7fc68dcb2f6fc1b5e201843e773144bd23a76cb3b97","urls":["bzz-raw://490712cc07db32f274899b17aade9c975f06010848c21500b8a5ead6898e09c7","dweb:/ipfs/QmZMPKjDgwCFSGdLWJW6g5E7hDLByA9hNjXzAwJ4GKTZvN"],"license":"BSD-4-Clause"},"src/PartyPoolHelpers.sol":{"keccak256":"0xd43b635d12b6684ae38a685eea4bc5783cebb3696514d8aafe3f4ce34f5e759c","urls":["bzz-raw://832046b365d443c4c1c715f98fe3de224e3ba82c67960053d51e6a79847c4af5","dweb:/ipfs/QmZ4nWMwyYQzaBGF7rBE73GYTs4z3DRNYL1ZrGAsxN6RfP"],"license":"UNLICENSED"}},"version":1},"id":52}
{"abi":[],"bytecode":{"object":"0x","sourceMap":"","linkReferences":{}},"deployedBytecode":{"object":"0x","sourceMap":"","linkReferences":{}},"methodIdentifiers":{},"rawMetadata":"{\"compiler\":{\"version\":\"0.8.30+commit.73712a01\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/PartyPoolHelpers.sol\":\"PartyPoolHelpers\"},\"evmVersion\":\"prague\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":100000000},\"remappings\":[\":@abdk/=lib/abdk-libraries-solidity/\",\":@openzeppelin/=lib/openzeppelin-contracts/\",\":abdk-libraries-solidity/=lib/abdk-libraries-solidity/\",\":erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/\",\":forge-std/=lib/forge-std/src/\",\":halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/\",\":openzeppelin-contracts/=lib/openzeppelin-contracts/\"],\"viaIR\":true},\"sources\":{\"lib/abdk-libraries-solidity/ABDKMath64x64.sol\":{\"keccak256\":\"0x1364fdc24192b982f647c7fc68dcb2f6fc1b5e201843e773144bd23a76cb3b97\",\"license\":\"BSD-4-Clause\",\"urls\":[\"bzz-raw://490712cc07db32f274899b17aade9c975f06010848c21500b8a5ead6898e09c7\",\"dweb:/ipfs/QmZMPKjDgwCFSGdLWJW6g5E7hDLByA9hNjXzAwJ4GKTZvN\"]},\"src/PartyPoolHelpers.sol\":{\"keccak256\":\"0xd43b635d12b6684ae38a685eea4bc5783cebb3696514d8aafe3f4ce34f5e759c\",\"license\":\"UNLICENSED\",\"urls\":[\"bzz-raw://832046b365d443c4c1c715f98fe3de224e3ba82c67960053d51e6a79847c4af5\",\"dweb:/ipfs/QmZ4nWMwyYQzaBGF7rBE73GYTs4z3DRNYL1ZrGAsxN6RfP\"]}},\"version\":1}","metadata":{"compiler":{"version":"0.8.30+commit.73712a01"},"language":"Solidity","output":{"abi":[],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"remappings":["@abdk/=lib/abdk-libraries-solidity/","@openzeppelin/=lib/openzeppelin-contracts/","abdk-libraries-solidity/=lib/abdk-libraries-solidity/","erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/","forge-std/=lib/forge-std/src/","halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/","openzeppelin-contracts/=lib/openzeppelin-contracts/"],"optimizer":{"enabled":true,"runs":100000000},"metadata":{"bytecodeHash":"ipfs"},"compilationTarget":{"src/PartyPoolHelpers.sol":"PartyPoolHelpers"},"evmVersion":"prague","libraries":{},"viaIR":true},"sources":{"lib/abdk-libraries-solidity/ABDKMath64x64.sol":{"keccak256":"0x1364fdc24192b982f647c7fc68dcb2f6fc1b5e201843e773144bd23a76cb3b97","urls":["bzz-raw://490712cc07db32f274899b17aade9c975f06010848c21500b8a5ead6898e09c7","dweb:/ipfs/QmZMPKjDgwCFSGdLWJW6g5E7hDLByA9hNjXzAwJ4GKTZvN"],"license":"BSD-4-Clause"},"src/PartyPoolHelpers.sol":{"keccak256":"0xd43b635d12b6684ae38a685eea4bc5783cebb3696514d8aafe3f4ce34f5e759c","urls":["bzz-raw://832046b365d443c4c1c715f98fe3de224e3ba82c67960053d51e6a79847c4af5","dweb:/ipfs/QmZ4nWMwyYQzaBGF7rBE73GYTs4z3DRNYL1ZrGAsxN6RfP"],"license":"UNLICENSED"}},"version":1},"id":53}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,17 +1,17 @@
{
"11155111": {
"v1": {
"PartyPlanner": "0x2954911231c44E49938b2FBd1e0cD2787FdF69AD",
"PartyPoolViewer": "0x71b04a353a77405a3217EAF3A24BA619B86cD5E9",
"PartyPoolMintImpl": "0x705272c50F905204187B3126701BeDEd82Dc2F9a",
"PartyPoolSwapImpl": "0xC9608aAaF772c1cAce83C863e88EC4FF54017CeB",
"PartyPoolDeployer": "0x6811C56804321F811eAFa3f7694b026d738Ba7a1",
"PartyPoolBalancedPairDeployer": "0xc321406Fc8e174Bb0D006C145D515b858b1b883d",
"USXD": "0x8E4D16886b8946dfE463fA172129eaBf4825fb09",
"FUSD": "0xdc225280216822CA956738390f589c794129bd53",
"DIVE": "0x7ba123e4e7395A361284d069bD0D545F3f820641",
"BUTC": "0x88125947BBF1A6dd0FeD4B257BB3f9E1FBdCb3Cc",
"WTETH": "0xC8dB65C0B9f4cf59097d4C5Bcb9e8E92B9e4e15F"
"PartyPlanner": "0x8b98050A007DDDd0c08396C22D1Ab7585e72A7fd",
"PartyInfo": "0x4178c024bf155A2712759A4C5a682FeD918f8dAE",
"PartyPoolMintImpl": "0xdc846b020d406Ec09Ab4e44999C90fDe52D9f223",
"PartyPoolSwapImpl": "0x95F86c7e03077a9C5D1a846BDa68ac03e1e1cE69",
"PartyPoolDeployer": "0x5Eb7B66e66e0F214AeE862E8585d205248620539",
"PartyPoolBalancedPairDeployer": "0x0d6acA720e42686531dC1A35c1234F0b2E1e92E0",
"USXD": "",
"FUSD": "",
"DIVE": "",
"BUTC": "",
"WTETH": ""
}
}
}

View File

@@ -9,7 +9,8 @@ remappings = [
optimizer=true
optimizer_runs=100000000 # maximum value allowed by etherscan's verifier XD. The max value is formally 2^32-1
viaIR=true
gas_reports = ['PartyPool', 'PartyPoolBalancedPair', 'PartyPlanner', 'PartyPoolSwapImpl', 'PartyPoolMintImpl',]
#gas_reports = ['PartyPool', 'PartyPoolBalancedPair', 'PartyPlanner', 'PartyPoolSwapImpl', 'PartyPoolMintImpl',]
gas_reports = ['PartyPool', 'PartyPoolBalancedPair', 'PartyPlanner']
fs_permissions = [{ access = "write", path = "liqp-deployments.json"}]
[lint]

View File

@@ -250,10 +250,15 @@ contract DeploySepolia is Script {
approveAll(address(pool));
console2.log('post-creation supply', pool.totalSupply());
// 1) Proportional mint (request some LP)
uint256 lpToMint = 1_234; // arbitrary non-even amount
// payer = this contract, receiver = this contract
pool.mint(msg.sender, msg.sender, lpToMint, 0);
uint256 minted = pool.mint(msg.sender, msg.sender, lpToMint, 0);
console2.log('minted', minted);
console2.log('post-mint supply', pool.totalSupply());
// 2) Proportional burn (withdraw a small, non-even amount of LP)
uint256 lpToBurn = 7;
@@ -286,7 +291,7 @@ contract DeploySepolia is Script {
// 7) Final swap-style operation: burnSwap (burn LP then swap to single asset)
// ensure we have some LP allowance
uint256 lpForBurnSwap = 3; // non-even small amount
uint256 lpForBurnSwap = 3 * 10**18; // non-even small amount
uint256 burnToIndex = (n > 1) ? 1 : 0;
pool.burnSwap(msg.sender, msg.sender, lpForBurnSwap, burnToIndex, 0, false);
}

View File

@@ -1,32 +0,0 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.30;
import {IERC20} from "../lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
import {IPartyPool} from "./IPartyPool.sol";
import {NativeWrapper} from "./NativeWrapper.sol";
import {PartyPoolMintImpl} from "./PartyPoolMintImpl.sol";
import {PartyPoolSwapImpl} from "./PartyPoolSwapImpl.sol";
interface IPartyPoolDeployer {
struct DeployParams {
address owner;
string memory name;
string memory symbol;
IERC20[] memory tokens;
int128 kappa;
uint256[] memory fees;
uint256 flashFeePpm;
uint256 protocolFeePpm;
address protocolFeeAddress;
NativeWrapper wrapper;
PartyPoolSwapImpl swapImpl;
PartyPoolMintImpl mintImpl;
}
function deploy(DeployParams memory params) external returns (IPartyPool pool);
function params() external returns (DeployParams memory params);
}

View File

@@ -544,7 +544,8 @@ library LMSRStabilized {
uint256 i,
int128 alpha
) internal pure returns (int128 amountIn, int128 amountOut) {
require(alpha > int128(0) && alpha <= ONE, "LMSR: alpha");
require(alpha > int128(0), "Burn too small");
require(alpha <= ONE, "Burn too large");
int128 sizeMetric = _computeSizeMetric(qInternal);
require(sizeMetric > int128(0), "LMSR: size metric zero");

View File

@@ -1,40 +1,91 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.30;
import {IERC20} from "../lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
import {IPartyPool} from "./IPartyPool.sol";
import {IPartyPoolDeployer} from "./IPartyPoolDeployer.sol";
import {NativeWrapper} from "./NativeWrapper.sol";
import "./PartyPoolMintImpl.sol";
import "./PartyPoolSwapImpl.sol";
import {PartyPool} from "./PartyPool.sol";
import {PartyPoolBalancedPair} from "./PartyPoolBalancedPair.sol";
import {PartyPoolMintImpl} from "./PartyPoolMintImpl.sol";
import {PartyPoolSwapImpl} from "./PartyPoolSwapImpl.sol";
// This pattern is needed because the PartyPlanner constructs two different types of pools (regular and balanced-pair)
// but doesn't have room to store the initialization code of both contracts. Therefore, we delegate pool construction.
abstract contract BasePartyPoolDeployer is IPartyPoolDeployer {
uint256 private nonce;
DeployParams public params;
function deploy(DeployParams memory params_) external returns (IPartyPool pool) {
params = params_;
pool = _doDeploy(nonce);
nonce += 1;
}
function _doDeploy(uint256 nonce) virtual internal returns (IPartyPool pool);
interface IPartyPoolDeployer {
function deploy(
address owner_,
string memory name_,
string memory symbol_,
IERC20[] memory tokens_,
int128 kappa_,
uint256[] memory fees_,
uint256 flashFeePpm_,
uint256 protocolFeePpm_,
address protocolFeeAddress_,
NativeWrapper wrapper_,
PartyPoolSwapImpl swapImpl_,
PartyPoolMintImpl mintImpl_
) external returns (IPartyPool pool);
}
contract PartyPoolDeployer is BasePartyPoolDeployer {
function _doDeploy(uint256 nonce) internal override returns (IPartyPool) {
return new PartyPool(nonce);
contract PartyPoolDeployer is IPartyPoolDeployer {
function deploy(
address owner_,
string memory name_,
string memory symbol_,
IERC20[] memory tokens_,
int128 kappa_,
uint256[] memory fees_,
uint256 flashFeePpm_,
uint256 protocolFeePpm_,
address protocolFeeAddress_,
NativeWrapper wrapper_,
PartyPoolSwapImpl swapImpl_,
PartyPoolMintImpl mintImpl_
) external returns (IPartyPool) {
return new PartyPool(
owner_,
name_,
symbol_,
tokens_,
kappa_,
fees_,
flashFeePpm_,
protocolFeePpm_,
protocolFeeAddress_,
wrapper_,
swapImpl_,
mintImpl_
);
}
}
contract PartyPoolBalancedPairDeployer is BasePartyPoolDeployer {
function _doDeploy(uint256 nonce) internal override returns (IPartyPool) {
return new PartyPoolBalancedPair(nonce);
contract PartyPoolBalancedPairDeployer is IPartyPoolDeployer {
function deploy(
address owner_,
string memory name_,
string memory symbol_,
IERC20[] memory tokens_,
int128 kappa_,
uint256[] memory fees_,
uint256 flashFeePpm_,
uint256 protocolFeePpm_,
address protocolFeeAddress_,
NativeWrapper wrapper_,
PartyPoolSwapImpl swapImpl_,
PartyPoolMintImpl mintImpl_
) external returns (IPartyPool) {
return new PartyPoolBalancedPair(
owner_,
name_,
symbol_,
tokens_,
kappa_,
fees_,
flashFeePpm_,
protocolFeePpm_,
protocolFeeAddress_,
wrapper_,
swapImpl_,
mintImpl_
);
}
}