Skip to content

Drc permit standard#3

Open
steel-judoka wants to merge 3 commits intoDusk-Forge:mainfrom
steel-judoka:drc_permit_standard
Open

Drc permit standard#3
steel-judoka wants to merge 3 commits intoDusk-Forge:mainfrom
steel-judoka:drc_permit_standard

Conversation

@steel-judoka
Copy link

Fixes #2

Introduces permit-based approvals, which allow a user to approve an allowance via an off-chain signature, rather than using approve() directly. This is inspired by EIP-2612 but is modified to fit Dusk’s crypto and ABI. In particular we don’t use EIP-712, and BLS and the hash function are used for signing and verification respectively.

What was added

  • permit(PermitCall) - Sets allowance(owner, spender) = value if the PermitCall contains a valid BLS signature from owner over a deterministic digest of owner, spender, value, nonce, and deadline.
  • permit_nonces(owner) -> u64
  • domain_separator() -> BlsScalar

Why not EIP-712?

EIP-2612 which introduces permit based approval, uses a signed message with a hash of typed structured data, which is computed via EIP-712. In this implementation we don’t use EIP-712. This is because:

  • Dusk uses BLS for signing, not secp256k1, and so the signing scheme and encoding are different.
  • We use a single hashing function, which is the hash function exposed through the ABI, abi::hash. This is used off-chain to compute the digest and is also used on-chain. This is simpler and more efficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add EIP-2612–style gasless approvals to DRC20

1 participant