def ecrecover
import bend-collections-laws-crypto@1.0.0.0/spec/crypto/secp256k1/ecdsa.bend as Ecdsaimport Base
import bend-collections-laws-crypto@1.0.0.0/spec/crypto/secp256k1/curve.bend as CV
328# ECRECOVER (precompile 0x01): the input zero-padded or cut to 128 bytes is
329# H || v || r || s, v a 32-byte big-endian word that must be 27 or 28;
330# the output is the address word (12 zero bytes, then the address) of the
331# key recovered with id v - 27, or nothing
332def ecrecover(+one: Nat, input: List<&2, U32>) -> Maybe<&2, List<&2, U32>>:
333 ecrecover_in(one, CV.first(128n, cat(input, fill(128n, 0))))