Add 512bits add and mult operations (#5035)

This commit is contained in:
Hadrien Croubois
2025-02-26 11:04:14 +01:00
committed by GitHub
parent 2ed8956992
commit f999ba42a1
5 changed files with 372 additions and 195 deletions

View File

@ -1,12 +1,14 @@
function Enum(...options) {
return Object.fromEntries(options.map((key, i) => [key, BigInt(i)]));
}
const { ethers } = require('ethers');
const Enum = (...options) => Object.fromEntries(options.map((key, i) => [key, BigInt(i)]));
const EnumTyped = (...options) => Object.fromEntries(options.map((key, i) => [key, ethers.Typed.uint8(i)]));
module.exports = {
Enum,
EnumTyped,
ProposalState: Enum('Pending', 'Active', 'Canceled', 'Defeated', 'Succeeded', 'Queued', 'Expired', 'Executed'),
VoteType: Object.assign(Enum('Against', 'For', 'Abstain'), { Parameters: 255n }),
Rounding: Enum('Floor', 'Ceil', 'Trunc', 'Expand'),
Rounding: EnumTyped('Floor', 'Ceil', 'Trunc', 'Expand'),
OperationState: Enum('Unset', 'Waiting', 'Ready', 'Done'),
RevertType: Enum('None', 'RevertWithoutMessage', 'RevertWithMessage', 'RevertWithCustomError', 'Panic'),
RevertType: EnumTyped('None', 'RevertWithoutMessage', 'RevertWithMessage', 'RevertWithCustomError', 'Panic'),
};