Skip to content

Commit

Permalink
ethers: add const assertion for exported ABI (#783)
Browse files Browse the repository at this point in the history
Fixes #782
  • Loading branch information
kdembler committed Dec 12, 2022
1 parent 8c056bf commit 31e6957
Show file tree
Hide file tree
Showing 36 changed files with 40 additions and 35 deletions.
5 changes: 5 additions & 0 deletions .changeset/tidy-seas-bow.md
@@ -0,0 +1,5 @@
---
'@typechain/ethers-v5': minor
---

Add const assertion for exported ABI
Expand Up @@ -59,7 +59,7 @@ const _abi = [
stateMutability: "view",
type: "function",
},
];
] as const;

const _bytecode =
"0x60806040526000805534801561001457600080fd5b506105f8806100246000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80630bd8599e146100465780635fcbd5b614610064578063a87d942c14610082575b600080fd5b61004e6100a0565b60405161005b9190610432565b60405180910390f35b61006c610183565b6040516100799190610432565b60405180910390f35b61008a610266565b6040516100979190610432565b60405180910390f35b60006100e36040518060400160405280601081526020017f636f756e7455703a20636f756e74203d0000000000000000000000000000000081525060005461026f565b600060016000546100f49190610469565b9050600054811161013a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161013190610412565b60405180910390fd5b806000819055507fa501f5a8ef1a812bff54fb3642cfaec066c351af1716c48a7bdd05e0bb631e676000546040516101729190610432565b60405180910390a160005491505090565b60006101c66040518060400160405280601281526020017f636f756e74446f776e3a20636f756e74203d000000000000000000000000000081525060005461026f565b600060016000546101d791906104bf565b9050600054811061021d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610214906103f2565b60405180910390fd5b806000819055507fa501f5a8ef1a812bff54fb3642cfaec066c351af1716c48a7bdd05e0bb631e676000546040516102559190610432565b60405180910390a160005491505090565b60008054905090565b61030782826040516024016102859291906103c2565b6040516020818303038152906040527f9710a9d0000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505061030b565b5050565b60008151905060006a636f6e736f6c652e6c6f679050602083016000808483855afa5050505050565b600061033f8261044d565b6103498185610458565b93506103598185602086016104fd565b6103628161055f565b840191505092915050565b600061037a601183610458565b915061038582610570565b602082019050919050565b600061039d601083610458565b91506103a882610599565b602082019050919050565b6103bc816104f3565b82525050565b600060408201905081810360008301526103dc8185610334565b90506103eb60208301846103b3565b9392505050565b6000602082019050818103600083015261040b8161036d565b9050919050565b6000602082019050818103600083015261042b81610390565b9050919050565b600060208201905061044760008301846103b3565b92915050565b600081519050919050565b600082825260208201905092915050565b6000610474826104f3565b915061047f836104f3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156104b4576104b3610530565b5b828201905092915050565b60006104ca826104f3565b91506104d5836104f3565b9250828210156104e8576104e7610530565b5b828203905092915050565b6000819050919050565b60005b8381101561051b578082015181840152602081019050610500565b8381111561052a576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000601f19601f8301169050919050565b7f55696e7432353620756e646572666c6f77000000000000000000000000000000600082015250565b7f55696e74323536206f766572666c6f770000000000000000000000000000000060008201525056fea264697066735822122062e7987659cfb72b2613b81304a8a0e3671f5a2351b8cfece1da96e99b6512b664736f6c63430008070033";
Expand Down
Expand Up @@ -47,7 +47,7 @@ const _abi = [
stateMutability: "nonpayable",
type: "constructor",
},
];
] as const;

const _bytecode =
"0x608060405234801561001057600080fd5b506040516103313803806103318339818101604052810190610032919061018c565b50506102e4565b600061004c6100478461020d565b6101e8565b9050808382526020820190508285604086028201111561006f5761006e6102ad565b5b60005b8581101561009f57816100858882610127565b845260208401935060408301925050600181019050610072565b5050509392505050565b600082601f8301126100be576100bd6102a3565b5b81516100ce848260208601610039565b91505092915050565b6000604082840312156100ed576100ec6102a8565b5b6100f760406101e8565b9050600061010784828501610177565b600083015250602061011b84828501610177565b60208301525092915050565b60006040828403121561013d5761013c6102a8565b5b61014760406101e8565b9050600061015784828501610177565b600083015250602061016b84828501610177565b60208301525092915050565b600081519050610186816102cd565b92915050565b600080606083850312156101a3576101a26102b7565b5b60006101b1858286016100d7565b925050604083015167ffffffffffffffff8111156101d2576101d16102b2565b5b6101de858286016100a9565b9150509250929050565b60006101f2610203565b90506101fe8282610243565b919050565b6000604051905090565b600067ffffffffffffffff82111561022857610227610274565b5b602082029050602081019050919050565b6000819050919050565b61024c826102bc565b810181811067ffffffffffffffff8211171561026b5761026a610274565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b6102d681610239565b81146102e157600080fd5b50565b603f806102f26000396000f3fe6080604052600080fdfea26469706673582212201d01eb5d1b5bdaa6bed6f2f157914e06e540802623813dc22be9be737413548164736f6c63430008070033";
Expand Down
Expand Up @@ -25,7 +25,7 @@ const _abi = [
stateMutability: "nonpayable",
type: "constructor",
},
];
] as const;

const _bytecode =
"0x6080604052348015600f57600080fd5b5060405160dc38038060dc8339818101604052810190602d91906045565b506090565b600081519050603f81607c565b92915050565b60006020828403121560585760576077565b5b60006064848285016032565b91505092915050565b6000819050919050565b600080fd5b608381606d565b8114608d57600080fd5b50565b603f80609d6000396000f3fe6080604052600080fdfea2646970667358221220133f91b0425ce510af8b75336b57852d3a7de1c90943e9b26ca086eabb5334d264736f6c63430008070033";
Expand Down
Expand Up @@ -34,7 +34,7 @@ const _abi = [
stateMutability: "nonpayable",
type: "constructor",
},
];
] as const;

const _bytecode =
"0x608060405234801561001057600080fd5b5060405161029a38038061029a8339818101604052810190610032919061012f565b5061024d565b600061004b61004684610181565b61015c565b905080828560408602820111156100655761006461021b565b5b60005b85811015610095578161007b88826100ca565b845260208401935060408301925050600181019050610068565b5050509392505050565b600082601f8301126100b4576100b3610211565b5b60026100c1848285610038565b91505092915050565b6000604082840312156100e0576100df610216565b5b6100ea604061015c565b905060006100fa8482850161011a565b600083015250602061010e8482850161011a565b60208301525092915050565b60008151905061012981610236565b92915050565b60006080828403121561014557610144610220565b5b60006101538482850161009f565b91505092915050565b6000610166610177565b905061017282826101b1565b919050565b6000604051905090565b600067ffffffffffffffff82111561019c5761019b6101e2565b5b602082029050919050565b6000819050919050565b6101ba82610225565b810181811067ffffffffffffffff821117156101d9576101d86101e2565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b61023f816101a7565b811461024a57600080fd5b50565b603f8061025b6000396000f3fe6080604052600080fdfea2646970667358221220ca8f8790c645fad67294067b65ba5ff0346d294dc27258dbd8582740604a13a164736f6c63430008070033";
Expand Down
Expand Up @@ -34,7 +34,7 @@ const _abi = [
stateMutability: "nonpayable",
type: "constructor",
},
];
] as const;

const _bytecode =
"0x608060405234801561001057600080fd5b506040516101fa3803806101fa833981810160405281019061003291906100a2565b50506101ad565b600082601f83011261004a57600080fd5b815161005d61005882610127565b6100f6565b9150808252602083016020830185838301111561007957600080fd5b610084838284610161565b50505092915050565b60008151905061009c81610196565b92915050565b600080604083850312156100b557600080fd5b60006100c38582860161008d565b925050602083015167ffffffffffffffff8111156100e057600080fd5b6100ec85828601610039565b9150509250929050565b6000604051905081810181811067ffffffffffffffff8211171561011d5761011c610194565b5b8060405250919050565b600067ffffffffffffffff82111561014257610141610194565b5b601f19601f8301169050602081019050919050565b6000819050919050565b60005b8381101561017f578082015181840152602081019050610164565b8381111561018e576000848401525b50505050565bfe5b61019f81610157565b81146101aa57600080fd5b50565b603f806101bb6000396000f3fe6080604052600080fdfea26469706673582212200ccd02b2235c9677aa904c1ddf3d6665b0fe8043aeac41f435eb43be8e02433f64736f6c63430007030033";
Expand Down
Expand Up @@ -28,7 +28,7 @@ const _abi = [
stateMutability: "nonpayable",
type: "constructor",
},
];
] as const;

const _bytecode =
"0x60806040526040518060400160405280600b81526020017f706c616365686f6c6465720000000000000000000000000000000000000000008152506001908051906020019061004f92919061009d565b5034801561005c57600080fd5b506040516101873803806101878339818101604052602081101561007f57600080fd5b8101908080519060200190929190505050806000819055505061013a565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100de57805160ff191683800117855561010c565b8280016001018555821561010c579182015b8281111561010b5782518255916020019190600101906100f0565b5b509050610119919061011d565b5090565b5b8082111561013657600081600090555060010161011e565b5090565b603f806101486000396000f3fe6080604052600080fdfea26469706673582212208274cbc0682bfe2bc644f008ad113b08d9bf64a4e18e321bb8bd76acde65d11b64736f6c63430007030033";
Expand Down
Expand Up @@ -28,7 +28,7 @@ const _abi = [
stateMutability: "nonpayable",
type: "constructor",
},
];
] as const;

const _bytecode =
"0x60806040526040518060400160405280600b81526020017f706c616365686f6c6465720000000000000000000000000000000000000000008152506002908051906020019061004f929190610131565b5034801561005c57600080fd5b5060405161021b38038061021b8339818101604052602081101561007f57600080fd5b81019080805190602001909291905050508073__$8978c1a1ad6ace79c6d069965308e960b0$__63771602f7909160146040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b1580156100ea57600080fd5b505af41580156100fe573d6000803e3d6000fd5b505050506040513d602081101561011457600080fd5b8101908080519060200190929190505050600181905550506101ce565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061017257805160ff19168380011785556101a0565b828001600101855582156101a0579182015b8281111561019f578251825591602001919060010190610184565b5b5090506101ad91906101b1565b5090565b5b808211156101ca5760008160009055506001016101b2565b5090565b603f806101dc6000396000f3fe6080604052600080fdfea26469706673582212205e7d3c628e59605cefaf83574bb5b3e32418c84d9801301bca538d248f4a770164736f6c63430007030033";
Expand Down
Expand Up @@ -106,7 +106,7 @@ const _abi = [
stateMutability: "pure",
type: "function",
},
];
] as const;

const _bytecode =
"0x610210610026600b82828239805160001a60731461001957fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100565760003560e01c8063771602f71461005b578063a391c15b146100a7578063b67d77c5146100f3578063c8a4ac9c1461013f575b600080fd5b6100916004803603604081101561007157600080fd5b81019080803590602001909291908035906020019092919050505061018b565b6040518082815260200191505060405180910390f35b6100dd600480360360408110156100bd57600080fd5b81019080803590602001909291908035906020019092919050505061019d565b6040518082815260200191505060405180910390f35b6101296004803603604081101561010957600080fd5b8101908080359060200190929190803590602001909291905050506101b6565b6040518082815260200191505060405180910390f35b6101756004803603604081101561015557600080fd5b8101908080359060200190929190803590602001909291905050506101c8565b6040518082815260200191505060405180910390f35b60008082840190508091505092915050565b6000808284816101a957fe5b0490508091505092915050565b60008082840390508091505092915050565b6000808284029050809150509291505056fea26469706673582212203c34f01efc94c8b101efa6073eac7b7664a0edb302f1f7cd4364fc6bef8a919164736f6c63430007030033";
Expand Down
Expand Up @@ -293,7 +293,7 @@ const _abi = [
stateMutability: "nonpayable",
type: "function",
},
];
] as const;

const _bytecode =
"0x60806040523480156200001157600080fd5b5060405162000cae38038062000cae833981810160405260408110156200003757600080fd5b81019080805160405193929190846401000000008211156200005857600080fd5b9083019060208201858111156200006e57600080fd5b82516401000000008111828201881017156200008957600080fd5b82525081516020918201929091019080838360005b83811015620000b85781810151838201526020016200009e565b50505050905090810190601f168015620000e65780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156200010a57600080fd5b9083019060208201858111156200012057600080fd5b82516401000000008111828201881017156200013b57600080fd5b82525081516020918201929091019080838360005b838110156200016a57818101518382015260200162000150565b50505050905090810190601f168015620001985780820380516001836020036101000a031916815260200191505b5060405250508251620001b491506003906020850190620001e0565b508051620001ca906004906020840190620001e0565b50506005805460ff19166012179055506200028c565b828054600181600116156101000203166002900490600052602060002090601f01602090048101928262000218576000855562000263565b82601f106200023357805160ff191683800117855562000263565b8280016001018555821562000263579182015b828111156200026357825182559160200191906001019062000246565b506200027192915062000275565b5090565b5b8082111562000271576000815560010162000276565b610a12806200029c6000396000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c80633950935111610081578063a457c2d71161005b578063a457c2d714610253578063a9059cbb1461027f578063dd62ed3e146102ab576100c9565b806339509351146101f957806370a082311461022557806395d89b411461024b576100c9565b806318160ddd116100b257806318160ddd1461018b57806323b872dd146101a5578063313ce567146101db576100c9565b806306fdde03146100ce578063095ea7b31461014b575b600080fd5b6100d66102d9565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101105781810151838201526020016100f8565b50505050905090810190601f16801561013d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101776004803603604081101561016157600080fd5b506001600160a01b03813516906020013561036f565b604080519115158252519081900360200190f35b61019361038c565b60408051918252519081900360200190f35b610177600480360360608110156101bb57600080fd5b506001600160a01b03813581169160208101359091169060400135610392565b6101e3610419565b6040805160ff9092168252519081900360200190f35b6101776004803603604081101561020f57600080fd5b506001600160a01b038135169060200135610422565b6101936004803603602081101561023b57600080fd5b50356001600160a01b0316610470565b6100d661048b565b6101776004803603604081101561026957600080fd5b506001600160a01b0381351690602001356104ec565b6101776004803603604081101561029557600080fd5b506001600160a01b038135169060200135610554565b610193600480360360408110156102c157600080fd5b506001600160a01b0381358116916020013516610568565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103655780601f1061033a57610100808354040283529160200191610365565b820191906000526020600020905b81548152906001019060200180831161034857829003601f168201915b5050505050905090565b600061038361037c610593565b8484610597565b50600192915050565b60025490565b600061039f848484610683565b61040f846103ab610593565b61040a85604051806060016040528060288152602001610947602891396001600160a01b038a166000908152600160205260408120906103e9610593565b6001600160a01b0316815260208101919091526040016000205491906107de565b610597565b5060019392505050565b60055460ff1690565b600061038361042f610593565b8461040a8560016000610440610593565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610875565b6001600160a01b031660009081526020819052604090205490565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103655780601f1061033a57610100808354040283529160200191610365565b60006103836104f9610593565b8461040a856040518060600160405280602581526020016109b86025913960016000610523610593565b6001600160a01b03908116825260208083019390935260409182016000908120918d168152925290205491906107de565b6000610383610561610593565b8484610683565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b0383166105dc5760405162461bcd60e51b81526004018080602001828103825260248152602001806109946024913960400191505060405180910390fd5b6001600160a01b0382166106215760405162461bcd60e51b81526004018080602001828103825260228152602001806108ff6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166106c85760405162461bcd60e51b815260040180806020018281038252602581526020018061096f6025913960400191505060405180910390fd5b6001600160a01b03821661070d5760405162461bcd60e51b81526004018080602001828103825260238152602001806108dc6023913960400191505060405180910390fd5b6107188383836108d6565b61075581604051806060016040528060268152602001610921602691396001600160a01b03861660009081526020819052604090205491906107de565b6001600160a01b0380851660009081526020819052604080822093909355908416815220546107849082610875565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6000818484111561086d5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561083257818101518382015260200161081a565b50505050905090810190601f16801561085f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000828201838110156108cf576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220de6adce7ed90f4a1e98fc98980665a1b15add220fef6a2bf9a8ae78bd8ea194064736f6c63430007060033";
Expand Down
Expand Up @@ -950,7 +950,7 @@ const _abi = [
stateMutability: "pure",
type: "function",
},
];
] as const;

export class DataTypesInput__factory {
static readonly abi = _abi;
Expand Down
Expand Up @@ -214,7 +214,7 @@ const _abi = [
stateMutability: "pure",
type: "function",
},
];
] as const;

export class DataTypesPure__factory {
static readonly abi = _abi;
Expand Down
Expand Up @@ -214,7 +214,7 @@ const _abi = [
stateMutability: "view",
type: "function",
},
];
] as const;

export class DataTypesView__factory {
static readonly abi = _abi;
Expand Down
Expand Up @@ -176,7 +176,7 @@ const _abi = [
stateMutability: "nonpayable",
type: "function",
},
];
] as const;

export class Events__factory {
static readonly abi = _abi;
Expand Down
Expand Up @@ -20,7 +20,7 @@ const _abi = [
name: "Committed",
type: "event",
},
];
] as const;

export class A__factory {
static readonly abi = _abi;
Expand Down
Expand Up @@ -33,7 +33,7 @@ const _abi = [
name: "Committed",
type: "event",
},
];
] as const;

export class B__factory {
static readonly abi = _abi;
Expand Down
Expand Up @@ -26,7 +26,7 @@ const _abi = [
stateMutability: "pure",
type: "function",
},
];
] as const;

export class Lib__factory {
static readonly abi = _abi;
Expand Down
Expand Up @@ -29,7 +29,7 @@ const _abi = [
stateMutability: "pure",
type: "function",
},
];
] as const;

export class LibraryConsumer__factory {
static readonly abi = _abi;
Expand Down
Expand Up @@ -36,7 +36,7 @@ const _abi = [
stateMutability: "view",
type: "function",
},
];
] as const;

export class NAME12mangling__factory {
static readonly abi = _abi;
Expand Down
Expand Up @@ -50,7 +50,7 @@ const _abi = [
stateMutability: "pure",
type: "function",
},
];
] as const;

export class Overloads__factory {
static readonly abi = _abi;
Expand Down
Expand Up @@ -23,7 +23,7 @@ const _abi = [
stateMutability: "nonpayable",
type: "function",
},
];
] as const;

export class PayableFactory__factory {
static readonly abi = _abi;
Expand Down

0 comments on commit 31e6957

Please sign in to comment.