-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
51 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { parseAbi } from 'viem' | ||
|
||
/** | ||
* @dev The bytecode for the getMarkets function, which depends on the mgv core contracts and the mgv reader contract. | ||
* function getMarkets(MgvReader reader) public view returns (MarketWithToken[] memory) { | ||
* (Market[] memory markets,) = reader.openMarkets(); | ||
* uint numMarkets = markets.length; | ||
* MarketWithToken[] memory marketsWithToken = new MarketWithToken[](numMarkets); | ||
* | ||
* for (uint i = 0; i < numMarkets;) { | ||
* IERC20 token0 = IERC20(markets[i].tkn0); | ||
* IERC20 token1 = IERC20(markets[i].tkn1); | ||
* | ||
* marketsWithToken[i] = MarketWithToken({ | ||
* tkn0: Token({ | ||
* token: address(token0), | ||
* decimals: token0.decimals(), | ||
* symbol: token0.symbol() | ||
* }), | ||
* tkn1: Token({ | ||
* token: address(token1), | ||
* decimals: token1.decimals(), | ||
* symbol: token1.symbol() | ||
* }), | ||
* adr: | ||
* tickSpacing: markets[i].tickSpacing | ||
* }); | ||
* | ||
* unchecked { | ||
* i++; | ||
* } | ||
* } | ||
* | ||
* return marketsWithToken; | ||
* } | ||
*/ | ||
export const getMarketsBytecode = | ||
'0x608060405234801561001057600080fd5b506108cb806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063d60d9bd714610030575b600080fd5b61004361003e366004610403565b610059565b60405161005091906104a0565b60405180910390f35b60606000826001600160a01b0316638267f6496040518163ffffffff1660e01b8152600401600060405180830381865afa15801561009b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526100c391908101906106d6565b50805190915060008167ffffffffffffffff8111156100e4576100e4610531565b60405190808252806020026020018201604052801561015957816020015b6040805160c081018252600060608083018281526080840183905260a08401829052835283518082018552828152602080820184905281860192909252818401529282015282526000199092019101816101025790505b50905060005b828110156103e257600084828151811061017b5761017b6107d1565b6020026020010151600001519050600085838151811061019d5761019d6107d1565b602002602001015160200151905060405180606001604052806040518060600160405280856001600160a01b03168152602001856001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801561020e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061023291906107e7565b60ff168152602001856001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa158015610278573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526102a0919081019061080a565b81525081526020016040518060600160405280846001600160a01b03168152602001846001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610300573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061032491906107e7565b60ff168152602001846001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa15801561036a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610392919081019061080a565b81525081526020018785815181106103ac576103ac6107d1565b6020026020010151604001518152508484815181106103cd576103cd6107d1565b6020908102919091010152505060010161015f565b50949350505050565b6001600160a01b038116811461040057600080fd5b50565b60006020828403121561041557600080fd5b8135610420816103eb565b9392505050565b60005b8381101561044257818101518382015260200161042a565b50506000910152565b60018060a01b03815116825260ff60208201511660208301526000604082015160606040850152805180606086015261048b816080870160208501610427565b601f01601f1916939093016080019392505050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b8381101561052357603f198984030185528151606081518186526104ed8287018261044b565b915050888201518582038a870152610505828261044b565b928901519589019590955250948701949250908601906001016104c7565b509098975050505050505050565b634e487b7160e01b600052604160045260246000fd5b604051610160810167ffffffffffffffff8111828210171561056b5761056b610531565b60405290565b6040516060810167ffffffffffffffff8111828210171561056b5761056b610531565b604051601f8201601f1916810167ffffffffffffffff811182821017156105bd576105bd610531565b604052919050565b600067ffffffffffffffff8211156105df576105df610531565b5060051b60200190565b600082601f8301126105fa57600080fd5b8151602061060f61060a836105c5565b610594565b828152610160928302850182019282820191908785111561062f57600080fd5b8387015b858110156106c95781818a03121561064b5760008081fd5b610653610547565b81518152858201518682015260408083015190820152606080830151908201526080808301519082015260a0808301519082015260c0808301519082015260e080830151908201526101008083015190820152610120808301519082015261014080830151908201528452928401928101610633565b5090979650505050505050565b60008060408084860312156106ea57600080fd5b835167ffffffffffffffff8082111561070257600080fd5b818601915086601f83011261071657600080fd5b8151602061072661060a836105c5565b8281526060928302850182019282820191908b85111561074557600080fd5b958301955b8487101561079f5780878d0312156107625760008081fd5b61076a610571565b8751610775816103eb565b815287850151610784816103eb565b8186015287890151898201528352958601959183019161074a565b50918901519197509094505050808311156107b957600080fd5b50506107c7858286016105e9565b9150509250929050565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156107f957600080fd5b815160ff8116811461042057600080fd5b60006020828403121561081c57600080fd5b815167ffffffffffffffff8082111561083457600080fd5b818401915084601f83011261084857600080fd5b81518181111561085a5761085a610531565b61086d601f8201601f1916602001610594565b915080825285602082850101111561088457600080fd5b6103e281602084016020860161042756fea26469706673582212209ca3fb95d424a89adb93fea0a33bbc95b9acfb2caa994376dec3cab5a0940fb264736f6c63430008150033' | ||
export const getMarketsABI = parseAbi([ | ||
'function getMarkets(address reader) view returns (((address token, uint8 decimals, string symbol) tkn0, (address token, uint8 decimals, string symbol) tkn1, uint256 tickSpacing)[])', | ||
]) |