|
| 1 | +// Automatically generated by forge bind-json. |
| 2 | +pragma solidity >=0.6.2 <0.9.0; |
| 3 | +pragma experimental ABIEncoderV2; |
| 4 | + |
| 5 | +import {EIP712Types} from 'tests/helpers/EIP712Types.sol'; |
| 6 | + |
| 7 | +interface Vm { |
| 8 | + function parseJsonTypeArray( |
| 9 | + string calldata json, |
| 10 | + string calldata key, |
| 11 | + string calldata typeDescription |
| 12 | + ) external pure returns (bytes memory); |
| 13 | + |
| 14 | + function parseJsonType( |
| 15 | + string calldata json, |
| 16 | + string calldata typeDescription |
| 17 | + ) external pure returns (bytes memory); |
| 18 | + |
| 19 | + function parseJsonType( |
| 20 | + string calldata json, |
| 21 | + string calldata key, |
| 22 | + string calldata typeDescription |
| 23 | + ) external pure returns (bytes memory); |
| 24 | + |
| 25 | + function serializeJsonType( |
| 26 | + string calldata typeDescription, |
| 27 | + bytes memory value |
| 28 | + ) external pure returns (string memory json); |
| 29 | + |
| 30 | + function serializeJsonType( |
| 31 | + string calldata objectKey, |
| 32 | + string calldata valueKey, |
| 33 | + string calldata typeDescription, |
| 34 | + bytes memory value |
| 35 | + ) external returns (string memory json); |
| 36 | +} |
| 37 | + |
| 38 | +library JsonBindings { |
| 39 | + Vm constant vm = Vm(address(uint160(uint256(keccak256('hevm cheat code'))))); |
| 40 | + |
| 41 | + // prettier-ignore |
| 42 | + string constant schema_BuyAssetWithSig = "BuyAssetWithSig(address originator,uint256 minAmount,address receiver,uint256 nonce,uint256 deadline)"; |
| 43 | + // prettier-ignore |
| 44 | + string constant schema_SellAssetWithSig = "SellAssetWithSig(address originator,uint256 maxAmount,address receiver,uint256 nonce,uint256 deadline)"; |
| 45 | + |
| 46 | + function serialize( |
| 47 | + EIP712Types.BuyAssetWithSig memory value |
| 48 | + ) internal pure returns (string memory) { |
| 49 | + return vm.serializeJsonType(schema_BuyAssetWithSig, abi.encode(value)); |
| 50 | + } |
| 51 | + |
| 52 | + function serialize( |
| 53 | + EIP712Types.BuyAssetWithSig memory value, |
| 54 | + string memory objectKey, |
| 55 | + string memory valueKey |
| 56 | + ) internal returns (string memory) { |
| 57 | + return vm.serializeJsonType(objectKey, valueKey, schema_BuyAssetWithSig, abi.encode(value)); |
| 58 | + } |
| 59 | + |
| 60 | + function deserializeBuyAssetWithSig( |
| 61 | + string memory json |
| 62 | + ) public pure returns (EIP712Types.BuyAssetWithSig memory) { |
| 63 | + return |
| 64 | + abi.decode(vm.parseJsonType(json, schema_BuyAssetWithSig), (EIP712Types.BuyAssetWithSig)); |
| 65 | + } |
| 66 | + |
| 67 | + function deserializeBuyAssetWithSig( |
| 68 | + string memory json, |
| 69 | + string memory path |
| 70 | + ) public pure returns (EIP712Types.BuyAssetWithSig memory) { |
| 71 | + return |
| 72 | + abi.decode( |
| 73 | + vm.parseJsonType(json, path, schema_BuyAssetWithSig), |
| 74 | + (EIP712Types.BuyAssetWithSig) |
| 75 | + ); |
| 76 | + } |
| 77 | + |
| 78 | + function deserializeBuyAssetWithSigArray( |
| 79 | + string memory json, |
| 80 | + string memory path |
| 81 | + ) public pure returns (EIP712Types.BuyAssetWithSig[] memory) { |
| 82 | + return |
| 83 | + abi.decode( |
| 84 | + vm.parseJsonTypeArray(json, path, schema_BuyAssetWithSig), |
| 85 | + (EIP712Types.BuyAssetWithSig[]) |
| 86 | + ); |
| 87 | + } |
| 88 | + |
| 89 | + function serialize( |
| 90 | + EIP712Types.SellAssetWithSig memory value |
| 91 | + ) internal pure returns (string memory) { |
| 92 | + return vm.serializeJsonType(schema_SellAssetWithSig, abi.encode(value)); |
| 93 | + } |
| 94 | + |
| 95 | + function serialize( |
| 96 | + EIP712Types.SellAssetWithSig memory value, |
| 97 | + string memory objectKey, |
| 98 | + string memory valueKey |
| 99 | + ) internal returns (string memory) { |
| 100 | + return vm.serializeJsonType(objectKey, valueKey, schema_SellAssetWithSig, abi.encode(value)); |
| 101 | + } |
| 102 | + |
| 103 | + function deserializeSellAssetWithSig( |
| 104 | + string memory json |
| 105 | + ) public pure returns (EIP712Types.SellAssetWithSig memory) { |
| 106 | + return |
| 107 | + abi.decode(vm.parseJsonType(json, schema_SellAssetWithSig), (EIP712Types.SellAssetWithSig)); |
| 108 | + } |
| 109 | + |
| 110 | + function deserializeSellAssetWithSig( |
| 111 | + string memory json, |
| 112 | + string memory path |
| 113 | + ) public pure returns (EIP712Types.SellAssetWithSig memory) { |
| 114 | + return |
| 115 | + abi.decode( |
| 116 | + vm.parseJsonType(json, path, schema_SellAssetWithSig), |
| 117 | + (EIP712Types.SellAssetWithSig) |
| 118 | + ); |
| 119 | + } |
| 120 | + |
| 121 | + function deserializeSellAssetWithSigArray( |
| 122 | + string memory json, |
| 123 | + string memory path |
| 124 | + ) public pure returns (EIP712Types.SellAssetWithSig[] memory) { |
| 125 | + return |
| 126 | + abi.decode( |
| 127 | + vm.parseJsonTypeArray(json, path, schema_SellAssetWithSig), |
| 128 | + (EIP712Types.SellAssetWithSig[]) |
| 129 | + ); |
| 130 | + } |
| 131 | +} |
0 commit comments