This repository has been archived by the owner on Apr 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Easy] Add GPv2Contract artefact (#91)
This PR adds the dependencies for GPv2 Settlement. Note, that part of the change accidentally slipped in to a hot fix I applied last week when trying to get autodeploy running (7213878) Given the setup of hardhat (which has separate jsons for each network) we are currently specifically importing the rinkeby artefact. We also cannot automatically load the deployed address as hardhat's .json is slightly different from truffle's. Given that this is the same for the Uniswap contract it might be ok to simply define the contract addresses in code somewhere (there is also cowprotocol/ethcontract-rs#382 tracking ethers support in ethcontracts). ### Test Plan Depending on the new contract in main works (if we add contracts to the solver's Cargo.toml)
- Loading branch information
Showing
3 changed files
with
3 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"abi":[{"inputs":[{"internalType":"contract GPv2Authentication","name":"authenticator_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"clearingPrices","type":"uint256[]"},{"internalType":"uint256","name":"feeFactor","type":"uint256"},{"internalType":"bytes","name":"encodedTrades","type":"bytes"},{"internalType":"bytes","name":"encodedInteractions","type":"bytes"},{"internalType":"bytes","name":"encodedOrderRefunds","type":"bytes"}],"name":"settle","outputs":[],"stateMutability":"view","type":"function"}],"bytecode":"0x60e060405234801561001057600080fd5b50604051610e9d380380610e9d8339818101604052602081101561003357600080fd5b5051606081811b6001600160601b03191660a0908152604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020808301919091527f6c85c0337eba1661327f94f3bf46c8a7f9311a563f4d5c948362567f5d8ed60c828401527ff9446b8e937d86f0bc87cac73923491692b123ca5f8761908494703758206adf9482019490945246608080830182905230838601528351808403909501855260c090920192839052835193909401929092209091526100fb90610130565b604051809103906000f080158015610117573d6000803e3d6000fd5b5060601b6001600160601b03191660c0525061013d9050565b6106fc806107a183390190565b60805160a05160601c60c05160601c61063c610165600039508061023452505061063c6000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80632c4888f014610030575b600080fd5b6101ec600480360360c081101561004657600080fd5b81019060208101813564010000000081111561006157600080fd5b82018360208201111561007357600080fd5b8035906020019184602083028401116401000000008311171561009557600080fd5b9193909290916020810190356401000000008111156100b357600080fd5b8201836020820111156100c557600080fd5b803590602001918460208302840111640100000000831117156100e757600080fd5b9193909282359260408101906020013564010000000081111561010957600080fd5b82018360208201111561011b57600080fd5b8035906020019184600183028401116401000000008311171561013d57600080fd5b91939092909160208101903564010000000081111561015b57600080fd5b82018360208201111561016d57600080fd5b8035906020019184600183028401116401000000008311171561018f57600080fd5b9193909290916020810190356401000000008111156101ad57600080fd5b8201836020820111156101bf57600080fd5b803590602001918460018302840111640100000000831117156101e157600080fd5b5090925090506101ee565b005b604080517f02cc250d000000000000000000000000000000000000000000000000000000008152336004820152905173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016916302cc250d916024808301926020929190829003018186803b15801561027a57600080fd5b505afa15801561028e573d6000803e3d6000fd5b505050506040513d60208110156102a457600080fd5b505161031157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f475076323a206e6f74206120736f6c7665720000000000000000000000000000604482015290519081900360640190fd5b891561037e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f6e6f742079657420696d706c656d656e74656400000000000000000000000000604482015290519081900360640190fd5b87156103eb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f6e6f742079657420696d706c656d656e74656400000000000000000000000000604482015290519081900360640190fd5b861561045857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f6e6f742079657420696d706c656d656e74656400000000000000000000000000604482015290519081900360640190fd5b84156104c557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f6e6f742079657420696d706c656d656e74656400000000000000000000000000604482015290519081900360640190fd5b821561053257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f6e6f742079657420696d706c656d656e74656400000000000000000000000000604482015290519081900360640190fd5b801561059f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f6e6f742079657420696d706c656d656e74656400000000000000000000000000604482015290519081900360640190fd5b604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f46696e616c3a206e6f742079657420696d706c656d656e746564000000000000604482015290519081900360640190fdfea2646970667358221220f749ca2352022bfad0ddbe959bedc5b9725618613c4909af516a94ce2d6f077e64736f6c6343000705003360a060405234801561001057600080fd5b5033606081901b6080526106cc61003060003980605d52506106cc6000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063ac9bfd8714610030575b600080fd5b61004361003e36600461057a565b610045565b005b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016146100bd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100b4906105ea565b60405180910390fd5b60005b8181101561014e576101468383838181106100d757fe5b6100ed926020606090920201908101915061055e565b338585858181106100fa57fe5b9050606002016040013586868681811061011057fe5b9050606002016020016020810190610128919061055e565b73ffffffffffffffffffffffffffffffffffffffff16929190610153565b6001016100c0565b505050565b6040805173ffffffffffffffffffffffffffffffffffffffff80861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd000000000000000000000000000000000000000000000000000000001790526101e89085906101ee565b50505050565b6060610250826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166102c69092919063ffffffff16565b80519091501561014e5780806020019051602081101561026f57600080fd5b505161014e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a81526020018061066d602a913960400191505060405180910390fd5b60606102d584846000856102df565b90505b9392505050565b60608247101561033a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806106476026913960400191505060405180910390fd5b6103438561049a565b6103ae57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600060608673ffffffffffffffffffffffffffffffffffffffff1685876040518082805190602001908083835b6020831061041857805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016103db565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461047a576040519150601f19603f3d011682016040523d82523d6000602084013e61047f565b606091505b509150915061048f8282866104a0565b979650505050505050565b3b151590565b606083156104af5750816102d8565b8251156104bf5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561052357818101518382015260200161050b565b50505050905090810190601f1680156105505780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b60006020828403121561056f578081fd5b81356102d881610621565b6000806020838503121561058c578081fd5b823567ffffffffffffffff808211156105a3578283fd5b818501915085601f8301126105b6578283fd5b8135818111156105c4578384fd5b8660206060830285010111156105d8578384fd5b60209290920196919550909350505050565b6020808252601d908201527f475076323a206e6f7420616c6c6f77616e636520726563697069656e74000000604082015260600190565b73ffffffffffffffffffffffffffffffffffffffff8116811461064357600080fd5b5056fe416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a26469706673582212204a873251ec6ce3ac14e86a76bc8e3594eea33e4ec86024b98761e0c0d92af8d064736f6c63430007050033","devdoc":{"author":"Gnosis Developers","kind":"dev","methods":{"settle(address[],uint256[],uint256,bytes,bytes,bytes)":{"details":"Settle the specified orders at a clearing price. Note that it is the responsibility of the caller to ensure that all GPv2 invariants are upheld for the input settlement, otherwise this call will revert. Namely: - The fee factor cannot lead to fees > 0.1% - All orders are valid and signed - Accounts have sufficient balance and approval. - Settlement contract has sufficient balance to execute trades. Note this implies that the accumulated fees held in the contract can also be used for settlement. This is OK since: - Solvers need to be authorized - Misbehaving solvers will be slashed for abusing accumulated fees for settlement - Critically, user orders are entirely protected Note that settlements can specify fees encoded as a fee factor. The fee factor to use for the trade. The actual fee is computed as `1 / feeFactor`. This means that the received amount is expected to be `executedBuyAmount * (feeFactor - 1) / feeFactor`. Note that a value of `0` is reserved to mean no fees. This is useful for example when settling directly with Uniswap where we don't want users to incur additional fees. Note that some parameters are encoded as packed bytes in order to save calldata gas. For more information on encoding format consult the [`GPv2Encoding`] library.","params":{"clearingPrices":"An array of clearing prices where the `i`-th price is for the `i`-th token in the [`tokens`] array.","encodedInteractions":"Encoded smart contract interactions.","encodedOrderRefunds":"Encoded order refunds for clearing storage related to invalid orders.","encodedTrades":"Encoded trades for signed EOA orders.","feeFactor":"The fee factor to use for the trade.","tokens":"An array of ERC20 tokens to be traded in the settlement. Orders and interactions encode tokens as indices into this array."}}},"stateVariables":{"DOMAIN_NAME":{"details":"The EIP-712 domain name used for computing the domain separator."},"DOMAIN_TYPE_HASH":{"details":"The EIP-712 domain type hash used for computing the domain separator."},"DOMAIN_VERSION":{"details":"The EIP-712 domain version used for computing the domain separator."},"allowanceManager":{"details":"The allowance manager which has access to EOA order funds. This contract is created during deployment"},"authenticator":{"details":"The authenticator is used to determine who can call the settle function. That is, only authorised solvers have the ability to invoke settlements. Any valid authenticator implements an isSolver method called by the onlySolver modifier below."},"domainSeparator":{"details":"The domain separator used for signing orders that gets mixed in making signatures for different domains incompatible. This domain separator is computed following the EIP-712 standard and has replay protection mixed in so that signed orders are only valid for specific GPv2 contracts."}},"title":"Gnosis Protocol v2 Settlement Contract","version":1},"userdoc":{"kind":"user","methods":{},"version":1}} |
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