amgi-ts
Version:
Typescript SDK for interacting with various AMGI Studios Eth Contracts.
1,823 lines (1,814 loc) • 103 kB
JavaScript
// src/governor/index.ts
import { Contract, Interface } from "ethers";
// src/utils/index.ts
async function events(contract, event, callback, on) {
if (on) await contract.on(event, callback);
else await contract.off(event, callback);
}
function changeRunner(contract, runner) {
return contract.connect(runner);
}
// src/utils/base_events.ts
var BaseEvents = class {
// protected store?: BaseStore;
constructor(contract) {
this.contract = contract;
}
async on(eventName, callback) {
const listener = async (...args) => {
const parsedArgs = this.parseEventArgs(eventName, args);
callback(parsedArgs);
};
await events(this.contract, eventName, listener, true);
}
parseEventArgs(eventName, args) {
const eventFragment = this.contract.interface.getEvent(eventName);
if (!eventFragment) {
throw new Error(`Event ${String(eventName)} not found in contract ABI`);
}
const eventObject = {};
eventFragment.inputs.forEach((input, index) => {
eventObject[input.name] = args[index];
});
return eventObject;
}
changeRunner(runner) {
this.contract = changeRunner(this.contract, runner);
}
};
// src/governor/events.ts
var Events = class extends BaseEvents {
constructor(contract) {
super(contract);
}
async proposalCreated(callback) {
await this.on("ProposalCreated", callback);
}
async proposalCanceled(callback) {
await this.on("ProposalCanceled", callback);
}
async proposalCanceledByCanceller(callback) {
await this.on("ProposalCanceledByCanceller", callback);
}
async proposalExecuted(callback) {
await this.on("ProposalExecuted", callback);
}
async proposalQueued(callback) {
await this.on("ProposalQueued", callback);
}
async proposalThresholdSet(callback) {
await this.on("ProposalThresholdSet", callback);
}
async quorumNumeratorUpdated(callback) {
await this.on("QuorumNumeratorUpdated", callback);
}
async roleAdminChanged(callback) {
await this.on("RoleAdminChanged", callback);
}
async roleGranted(callback) {
await this.on("RoleGranted", callback);
}
async roleRevoked(callback) {
await this.on("RoleRevoked", callback);
}
async timelockChange(callback) {
await this.on("TimelockChange", callback);
}
async voteCast(callback) {
await this.on("VoteCast", callback);
}
async voteCastWithParams(callback) {
await this.on("VoteCastWithParams", callback);
}
async votingDelaySet(callback) {
await this.on("VotingDelaySet", callback);
}
async votingPeriodSet(callback) {
await this.on("VotingPeriodSet", callback);
}
async eip712DomainChanged(callback) {
await this.on("EIP712DomainChanged", callback);
}
};
// src/governor/fetch.ts
var Fetch = class {
constructor(contract) {
this.contract = contract;
}
proposalCreated(from, to) {
return this.contract.queryFilter("ProposalCreated", from, to);
}
proposalCanceled(from, to) {
return this.contract.queryFilter("ProposalCanceled", from, to);
}
proposalCanceledByCanceller(from, to) {
return this.contract.queryFilter("ProposalCanceledByCanceller", from, to);
}
proposalExecuted(from, to) {
return this.contract.queryFilter("ProposalExecuted", from, to);
}
proposalQueued(from, to) {
return this.contract.queryFilter("ProposalQueued", from, to);
}
proposalThresholdSet(from, to) {
return this.contract.queryFilter("ProposalThresholdSet", from, to);
}
quorumNumeratorUpdated(from, to) {
return this.contract.queryFilter("QuorumNumeratorUpdated", from, to);
}
roleAdminChanged(from, to) {
return this.contract.queryFilter("RoleAdminChanged", from, to);
}
roleGranted(from, to) {
return this.contract.queryFilter("RoleGranted", from, to);
}
roleRevoked(from, to) {
return this.contract.queryFilter("RoleRevoked", from, to);
}
timelockChange(from, to) {
return this.contract.queryFilter("TimelockChange", from, to);
}
voteCast(from, to) {
return this.contract.queryFilter("VoteCast", from, to);
}
voteCastWithParams(from, to) {
return this.contract.queryFilter("VoteCastWithParams", from, to);
}
votingDelaySet(from, to) {
return this.contract.queryFilter("VotingDelaySet", from, to);
}
votingPeriodSet(from, to) {
return this.contract.queryFilter("VotingPeriodSet", from, to);
}
domainChanged(from, to) {
return this.contract.queryFilter("EIP712DomainChanged", from, to);
}
ballotTypehash() {
return this.contract.BALLOT_TYPEHASH();
}
cancellerRole() {
return this.contract.CANCELLER_ROLE();
}
clockMode() {
return this.contract.CLOCK_MODE();
}
clock() {
return this.contract.clock();
}
countingMode() {
return this.contract.COUNTING_MODE();
}
defaultAdminRole() {
return this.contract.DEFAULT_ADMIN_ROLE();
}
domain() {
return this.contract.eip712Domain();
}
extendedBallotTypehash() {
return this.contract.EXTENDED_BALLOT_TYPEHASH();
}
circulatingSupply() {
return this.contract.circulatingSupply();
}
getIncreaseNumerator() {
return this.contract.getIncreaseNumerator();
}
getRoleAdmin(role) {
return this.contract.getRoleAdmin(role);
}
getVotes(account, timepoint) {
return this.contract.getVotes(account, timepoint);
}
getVotesWithParams(account, timepoint, params) {
return this.contract.getVotesWithParams(account, timepoint, params);
}
hasRole(role, account) {
return this.contract.hasRole(role, account);
}
hasVoted(proposalId, account) {
return this.contract.hasVoted(proposalId, account);
}
isATarget(targets) {
return this.contract.isATargetTheGovernor(targets);
}
karrat() {
return this.contract.karrat();
}
lastAdjustedCancelerRole() {
return this.contract.lastAdjustedCancelerRole();
}
name() {
return this.contract.name();
}
nonces(owner) {
return this.contract.nonces(owner);
}
notCirculatingWalletOne() {
return this.contract.contractNotCirculatingWalletOne();
}
notCirculatingWalletTwo() {
return this.contract.contractNotCirculatingWalletTwo();
}
proposalDeadline(proposalId) {
return this.contract.proposalDeadline(proposalId);
}
proposalEta(proposalId) {
return this.contract.proposalEta(proposalId);
}
proposalNeedsQueuing(proposalId) {
return this.contract.proposalNeedsQueuing(proposalId);
}
proposalProposer(proposalId) {
return this.contract.proposalProposer(proposalId);
}
proposalSnapshot(proposalId) {
return this.contract.proposalSnapshot(proposalId);
}
proposalThreshold(proposalId) {
return this.contract.proposalThreshold(proposalId);
}
async proposalVotes(proposalId) {
let res = await this.contract.proposalVotes(proposalId);
return {
against: res[0],
for: res[1],
abstain: res[2],
total: res[0] + res[1] + res[2]
};
}
quorum(timepoint) {
return this.contract.quorum(timepoint);
}
quorumDenominator() {
return this.contract.quorumDenominator();
}
quorumNumerator(timepoint) {
return this.contract.quorumNumerator(timepoint);
}
state(proposalId) {
return this.contract.state(proposalId);
}
supportsInterface(interfaceId) {
return this.contract.supportsInterface(interfaceId);
}
timelock() {
return this.contract.timelock();
}
timelockControllerAddress() {
return this.contract.timelockControllerAddress();
}
token() {
return this.contract.token();
}
version() {
return this.contract.version();
}
votingDelay() {
return this.contract.votingDelay();
}
votingPeriod() {
return this.contract.votingPeriod();
}
changeRunner(runner) {
this.contract = changeRunner(this.contract, runner);
}
};
// src/governor/execute.ts
var Execute = class {
constructor(contract) {
this.contract = contract;
}
cancel(targets, values, calldatas, proposalDescription) {
return this.contract.cancel(
targets,
values,
calldatas,
proposalDescription
);
}
cancelProposal(targets, values, calldatas, proposalDescription, proposalId, reason) {
return this.contract.cancelProposal(
targets,
values,
calldatas,
proposalDescription,
proposalId,
reason
);
}
cancelProposalInTimelock(proposalId, id, reason) {
return this.contract.cancelProposalInTimelock(proposalId, id, reason);
}
cancellerRemoval(remove) {
return this.contract.cancellerRemoval(remove);
}
castVote(proposalId, support) {
return this.contract.castVote(proposalId, support);
}
castVoteBySig(proposalId, support, voter, sig) {
return this.contract.castVoteBySig(proposalId, support, voter, sig);
}
castVoteWithReason(proposalId, support, reason) {
return this.contract.castVoteWithReason(proposalId, support, reason);
}
castVoteWithReasonAndParams(proposalId, support, reason, params) {
return this.contract.castVoteWithReasonAndParams(
proposalId,
support,
reason,
params
);
}
castVoteWithReasonAndParamsBySig(proposalId, support, reason, params, sig) {
return this.contract.castVoteWithReasonAndParamsBySig(
proposalId,
support,
reason,
params,
sig
);
}
execute(targets, values, calldatas, proposalDescription) {
return this.contract.execute(
targets,
values,
calldatas,
proposalDescription
);
}
fireCanceller(fired) {
return this.contract.fireCanceller(fired);
}
grantRole(role, account) {
return this.contract.grantRole(role, account);
}
propose(targets, values, calldatas, description) {
return this.contract.propose(targets, values, calldatas, description);
}
queue(targets, values, calldatas, proposalDescription) {
return this.contract.queue(targets, values, calldatas, proposalDescription);
}
rejectProposalAction(proposalId) {
return this.contract.rejectProposalAction(proposalId);
}
relay(target, value, data) {
return this.contract.relay(target, value, data);
}
renounceRole(role, callerConfirmation) {
return this.contract.renounceRole(role, callerConfirmation);
}
revokeRole(role, account) {
return this.contract.revokeRole(role, account);
}
setProposalThreshold(newProposalThreshold) {
return this.contract.setProposalThreshold(newProposalThreshold);
}
setVotingDelay(newVotingDelay) {
return this.contract.setVotingDelay(newVotingDelay);
}
setVotingPeriod(newVotingPeriod) {
return this.contract.setVotingPeriod(newVotingPeriod);
}
swapRoles(formerCancellers, newCancellers) {
return this.contract.swapRoles(formerCancellers, newCancellers);
}
changeRunner(runner) {
return this.contract.changeRunner(this.contract, runner);
}
updateQuorumNumerator(newQuorumNumerator) {
return this.contract.updateQuorumNumberator(newQuorumNumerator);
}
updateTimelock(newTimelock) {
return this.contract.updateTimelock(newTimelock);
}
};
// src/utils/base_coder.ts
var BaseCoder = class {
constructor(address, iface) {
this.address = address;
this.interface = iface;
}
decode(targets, calldatas) {
const decodedParamsArray = [];
for (let i = 0; i < targets.length; i++) {
if (targets[i] == this.address) {
const functionSelector = calldatas[i].slice(0, 10);
const functionFragment = this.interface.getFunction(functionSelector);
if (!functionFragment) {
continue;
}
const decodedParams = this.interface.decodeFunctionData(
functionFragment.name,
calldatas[i]
);
decodedParamsArray.push({
index: i,
functionName: functionFragment.name,
params: decodedParams.toArray()
});
}
}
return decodedParamsArray;
}
};
// src/governor/coder.ts
var Coder = class extends BaseCoder {
constructor(address, iface) {
super(address, iface);
}
};
// src/ABI/governor.ts
var governorABI = [
{
inputs: [
{ internalType: "contract IVotes", name: "_token", type: "address" },
{
internalType: "contract TimelockController",
name: "_timelock",
type: "address"
},
{ internalType: "address[]", name: "cancel", type: "address[]" },
{
internalType: "address",
name: "_notCirculatingWalletOne",
type: "address"
},
{
internalType: "address",
name: "_notCirculatingWalletTwo",
type: "address"
}
],
stateMutability: "nonpayable",
type: "constructor"
},
{ inputs: [], name: "AccessControlBadConfirmation", type: "error" },
{
inputs: [
{ internalType: "address", name: "account", type: "address" },
{ internalType: "bytes32", name: "neededRole", type: "bytes32" }
],
name: "AccessControlUnauthorizedAccount",
type: "error"
},
{ inputs: [], name: "CheckpointUnorderedInsertion", type: "error" },
{ inputs: [], name: "FailedInnerCall", type: "error" },
{
inputs: [{ internalType: "address", name: "voter", type: "address" }],
name: "GovernorAlreadyCastVote",
type: "error"
},
{
inputs: [{ internalType: "uint256", name: "proposalId", type: "uint256" }],
name: "GovernorAlreadyQueuedProposal",
type: "error"
},
{ inputs: [], name: "GovernorDisabledDeposit", type: "error" },
{
inputs: [
{ internalType: "address", name: "proposer", type: "address" },
{ internalType: "uint256", name: "votes", type: "uint256" },
{ internalType: "uint256", name: "threshold", type: "uint256" }
],
name: "GovernorInsufficientProposerVotes",
type: "error"
},
{
inputs: [
{ internalType: "uint256", name: "targets", type: "uint256" },
{ internalType: "uint256", name: "calldatas", type: "uint256" },
{ internalType: "uint256", name: "values", type: "uint256" }
],
name: "GovernorInvalidProposalLength",
type: "error"
},
{
inputs: [
{ internalType: "uint256", name: "quorumNumerator", type: "uint256" },
{ internalType: "uint256", name: "quorumDenominator", type: "uint256" }
],
name: "GovernorInvalidQuorumFraction",
type: "error"
},
{
inputs: [{ internalType: "address", name: "voter", type: "address" }],
name: "GovernorInvalidSignature",
type: "error"
},
{ inputs: [], name: "GovernorInvalidVoteType", type: "error" },
{
inputs: [
{ internalType: "uint256", name: "votingPeriod", type: "uint256" }
],
name: "GovernorInvalidVotingPeriod",
type: "error"
},
{
inputs: [{ internalType: "uint256", name: "proposalId", type: "uint256" }],
name: "GovernorNonexistentProposal",
type: "error"
},
{
inputs: [{ internalType: "uint256", name: "proposalId", type: "uint256" }],
name: "GovernorNotQueuedProposal",
type: "error"
},
{
inputs: [{ internalType: "address", name: "account", type: "address" }],
name: "GovernorOnlyExecutor",
type: "error"
},
{
inputs: [{ internalType: "address", name: "account", type: "address" }],
name: "GovernorOnlyProposer",
type: "error"
},
{ inputs: [], name: "GovernorQueueNotImplemented", type: "error" },
{
inputs: [{ internalType: "address", name: "proposer", type: "address" }],
name: "GovernorRestrictedProposer",
type: "error"
},
{
inputs: [
{ internalType: "uint256", name: "proposalId", type: "uint256" },
{
internalType: "enum IGovernor.ProposalState",
name: "current",
type: "uint8"
},
{ internalType: "bytes32", name: "expectedStates", type: "bytes32" }
],
name: "GovernorUnexpectedProposalState",
type: "error"
},
{
inputs: [
{ internalType: "address", name: "account", type: "address" },
{ internalType: "uint256", name: "currentNonce", type: "uint256" }
],
name: "InvalidAccountNonce",
type: "error"
},
{ inputs: [], name: "InvalidShortString", type: "error" },
{ inputs: [], name: "NotEnoughApprovals", type: "error" },
{ inputs: [], name: "NotEnoughRejections", type: "error" },
{ inputs: [], name: "NotEnoughVotes_FiveOverSixNeeded", type: "error" },
{ inputs: [], name: "NotRoleChangeTimeYet", type: "error" },
{ inputs: [], name: "QueueEmpty", type: "error" },
{ inputs: [], name: "QueueFull", type: "error" },
{
inputs: [
{ internalType: "uint8", name: "bits", type: "uint8" },
{ internalType: "uint256", name: "value", type: "uint256" }
],
name: "SafeCastOverflowedUintDowncast",
type: "error"
},
{
inputs: [{ internalType: "string", name: "str", type: "string" }],
name: "StringTooLong",
type: "error"
},
{
inputs: [{ internalType: "uint256", name: "timeLeft", type: "uint256" }],
name: "WaitTimeNotOver",
type: "error"
},
{ anonymous: false, inputs: [], name: "EIP712DomainChanged", type: "event" },
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "uint256",
name: "proposalId",
type: "uint256"
}
],
name: "ProposalCanceled",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "canceller",
type: "address"
},
{
indexed: true,
internalType: "uint256",
name: "proposalId",
type: "uint256"
},
{ indexed: true, internalType: "string", name: "reason", type: "string" }
],
name: "ProposalCanceledByCanceller",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "uint256",
name: "proposalId",
type: "uint256"
},
{
indexed: false,
internalType: "address",
name: "proposer",
type: "address"
},
{
indexed: false,
internalType: "address[]",
name: "targets",
type: "address[]"
},
{
indexed: false,
internalType: "uint256[]",
name: "values",
type: "uint256[]"
},
{
indexed: false,
internalType: "string[]",
name: "signatures",
type: "string[]"
},
{
indexed: false,
internalType: "bytes[]",
name: "calldatas",
type: "bytes[]"
},
{
indexed: false,
internalType: "uint256",
name: "voteStart",
type: "uint256"
},
{
indexed: false,
internalType: "uint256",
name: "voteEnd",
type: "uint256"
},
{
indexed: false,
internalType: "string",
name: "description",
type: "string"
}
],
name: "ProposalCreated",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "uint256",
name: "proposalId",
type: "uint256"
}
],
name: "ProposalExecuted",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "uint256",
name: "proposalId",
type: "uint256"
},
{
indexed: false,
internalType: "uint256",
name: "etaSeconds",
type: "uint256"
}
],
name: "ProposalQueued",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "uint256",
name: "oldProposalThreshold",
type: "uint256"
},
{
indexed: false,
internalType: "uint256",
name: "newProposalThreshold",
type: "uint256"
}
],
name: "ProposalThresholdSet",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "uint256",
name: "oldQuorumNumerator",
type: "uint256"
},
{
indexed: false,
internalType: "uint256",
name: "newQuorumNumerator",
type: "uint256"
}
],
name: "QuorumNumeratorUpdated",
type: "event"
},
{
anonymous: false,
inputs: [
{ indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
{
indexed: true,
internalType: "bytes32",
name: "previousAdminRole",
type: "bytes32"
},
{
indexed: true,
internalType: "bytes32",
name: "newAdminRole",
type: "bytes32"
}
],
name: "RoleAdminChanged",
type: "event"
},
{
anonymous: false,
inputs: [
{ indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
{
indexed: true,
internalType: "address",
name: "account",
type: "address"
},
{
indexed: true,
internalType: "address",
name: "sender",
type: "address"
}
],
name: "RoleGranted",
type: "event"
},
{
anonymous: false,
inputs: [
{ indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
{
indexed: true,
internalType: "address",
name: "account",
type: "address"
},
{
indexed: true,
internalType: "address",
name: "sender",
type: "address"
}
],
name: "RoleRevoked",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "address",
name: "oldTimelock",
type: "address"
},
{
indexed: false,
internalType: "address",
name: "newTimelock",
type: "address"
}
],
name: "TimelockChange",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "voter",
type: "address"
},
{
indexed: false,
internalType: "uint256",
name: "proposalId",
type: "uint256"
},
{ indexed: false, internalType: "uint8", name: "support", type: "uint8" },
{
indexed: false,
internalType: "uint256",
name: "weight",
type: "uint256"
},
{
indexed: false,
internalType: "string",
name: "reason",
type: "string"
}
],
name: "VoteCast",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "voter",
type: "address"
},
{
indexed: false,
internalType: "uint256",
name: "proposalId",
type: "uint256"
},
{ indexed: false, internalType: "uint8", name: "support", type: "uint8" },
{
indexed: false,
internalType: "uint256",
name: "weight",
type: "uint256"
},
{
indexed: false,
internalType: "string",
name: "reason",
type: "string"
},
{ indexed: false, internalType: "bytes", name: "params", type: "bytes" }
],
name: "VoteCastWithParams",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "uint256",
name: "oldVotingDelay",
type: "uint256"
},
{
indexed: false,
internalType: "uint256",
name: "newVotingDelay",
type: "uint256"
}
],
name: "VotingDelaySet",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "uint256",
name: "oldVotingPeriod",
type: "uint256"
},
{
indexed: false,
internalType: "uint256",
name: "newVotingPeriod",
type: "uint256"
}
],
name: "VotingPeriodSet",
type: "event"
},
{
inputs: [],
name: "BALLOT_TYPEHASH",
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "CANCELLER_ROLE",
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "CLOCK_MODE",
outputs: [{ internalType: "string", name: "", type: "string" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "COUNTING_MODE",
outputs: [{ internalType: "string", name: "", type: "string" }],
stateMutability: "pure",
type: "function"
},
{
inputs: [],
name: "DEFAULT_ADMIN_ROLE",
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "EXTENDED_BALLOT_TYPEHASH",
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
stateMutability: "view",
type: "function"
},
{
inputs: [
{ internalType: "address[]", name: "targets", type: "address[]" },
{ internalType: "uint256[]", name: "values", type: "uint256[]" },
{ internalType: "bytes[]", name: "calldatas", type: "bytes[]" },
{ internalType: "bytes32", name: "proposalDescription", type: "bytes32" }
],
name: "cancel",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{ internalType: "address[]", name: "targets", type: "address[]" },
{ internalType: "uint256[]", name: "values", type: "uint256[]" },
{ internalType: "bytes[]", name: "calldatas", type: "bytes[]" },
{ internalType: "bytes32", name: "proposalDescription", type: "bytes32" },
{ internalType: "uint256", name: "proposalId", type: "uint256" },
{ internalType: "string", name: "reason", type: "string" }
],
name: "cancelProposal",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{ internalType: "uint256", name: "proposalId", type: "uint256" },
{ internalType: "bytes32", name: "id", type: "bytes32" },
{ internalType: "string", name: "reason", type: "string" }
],
name: "cancelProposalInTimelock",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [{ internalType: "address", name: "remove", type: "address" }],
name: "cancellerRemoval",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{ internalType: "uint256", name: "proposalId", type: "uint256" },
{ internalType: "uint8", name: "support", type: "uint8" }
],
name: "castVote",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{ internalType: "uint256", name: "proposalId", type: "uint256" },
{ internalType: "uint8", name: "support", type: "uint8" },
{ internalType: "address", name: "voter", type: "address" },
{ internalType: "bytes", name: "signature", type: "bytes" }
],
name: "castVoteBySig",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{ internalType: "uint256", name: "proposalId", type: "uint256" },
{ internalType: "uint8", name: "support", type: "uint8" },
{ internalType: "string", name: "reason", type: "string" }
],
name: "castVoteWithReason",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{ internalType: "uint256", name: "proposalId", type: "uint256" },
{ internalType: "uint8", name: "support", type: "uint8" },
{ internalType: "string", name: "reason", type: "string" },
{ internalType: "bytes", name: "params", type: "bytes" }
],
name: "castVoteWithReasonAndParams",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{ internalType: "uint256", name: "proposalId", type: "uint256" },
{ internalType: "uint8", name: "support", type: "uint8" },
{ internalType: "address", name: "voter", type: "address" },
{ internalType: "string", name: "reason", type: "string" },
{ internalType: "bytes", name: "params", type: "bytes" },
{ internalType: "bytes", name: "signature", type: "bytes" }
],
name: "castVoteWithReasonAndParamsBySig",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [{ internalType: "bytes[]", name: "calldatas", type: "bytes[]" }],
name: "checkForFireCancellerCall",
outputs: [
{ internalType: "bool", name: "hasFireCancellerCall", type: "bool" }
],
stateMutability: "pure",
type: "function"
},
{
inputs: [
{ internalType: "uint256", name: "forVotes", type: "uint256" },
{ internalType: "uint256", name: "againstVotes", type: "uint256" }
],
name: "checkIfForVotesAreFiveTimesAgainstVotes",
outputs: [
{ internalType: "bool", name: "isFiveTimesGreater", type: "bool" }
],
stateMutability: "pure",
type: "function"
},
{
inputs: [],
name: "circulatingSupply",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "clock",
outputs: [{ internalType: "uint48", name: "", type: "uint48" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "eip712Domain",
outputs: [
{ internalType: "bytes1", name: "fields", type: "bytes1" },
{ internalType: "string", name: "name", type: "string" },
{ internalType: "string", name: "version", type: "string" },
{ internalType: "uint256", name: "chainId", type: "uint256" },
{ internalType: "address", name: "verifyingContract", type: "address" },
{ internalType: "bytes32", name: "salt", type: "bytes32" },
{ internalType: "uint256[]", name: "extensions", type: "uint256[]" }
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{ internalType: "address[]", name: "targets", type: "address[]" },
{ internalType: "uint256[]", name: "values", type: "uint256[]" },
{ internalType: "bytes[]", name: "calldatas", type: "bytes[]" },
{ internalType: "bytes32", name: "proposalDescription", type: "bytes32" }
],
name: "execute",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "payable",
type: "function"
},
{
inputs: [{ internalType: "address", name: "fired", type: "address" }],
name: "fireCanceller",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [],
name: "getIncreaseNumerator",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "bytes32", name: "role", type: "bytes32" }],
name: "getRoleAdmin",
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
stateMutability: "view",
type: "function"
},
{
inputs: [
{ internalType: "address", name: "account", type: "address" },
{ internalType: "uint256", name: "timepoint", type: "uint256" }
],
name: "getVotes",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "view",
type: "function"
},
{
inputs: [
{ internalType: "address", name: "account", type: "address" },
{ internalType: "uint256", name: "timepoint", type: "uint256" },
{ internalType: "bytes", name: "params", type: "bytes" }
],
name: "getVotesWithParams",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "view",
type: "function"
},
{
inputs: [
{ internalType: "bytes32", name: "role", type: "bytes32" },
{ internalType: "address", name: "account", type: "address" }
],
name: "grantRole",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{ internalType: "bytes32", name: "role", type: "bytes32" },
{ internalType: "address", name: "account", type: "address" }
],
name: "hasRole",
outputs: [{ internalType: "bool", name: "", type: "bool" }],
stateMutability: "view",
type: "function"
},
{
inputs: [
{ internalType: "uint256", name: "proposalId", type: "uint256" },
{ internalType: "address", name: "account", type: "address" }
],
name: "hasVoted",
outputs: [{ internalType: "bool", name: "", type: "bool" }],
stateMutability: "view",
type: "function"
},
{
inputs: [
{ internalType: "address[]", name: "targets", type: "address[]" },
{ internalType: "uint256[]", name: "values", type: "uint256[]" },
{ internalType: "bytes[]", name: "calldatas", type: "bytes[]" },
{ internalType: "bytes32", name: "proposalDescription", type: "bytes32" }
],
name: "hashProposal",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "pure",
type: "function"
},
{
inputs: [{ internalType: "address[]", name: "targets", type: "address[]" }],
name: "isATargetTheGovernor",
outputs: [{ internalType: "bool", name: "", type: "bool" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "karrat",
outputs: [{ internalType: "address", name: "", type: "address" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "lastAdjustedCancelerRole",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "name",
outputs: [{ internalType: "string", name: "", type: "string" }],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "address", name: "owner", type: "address" }],
name: "nonces",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "notCirculatingWalletOne",
outputs: [{ internalType: "address", name: "", type: "address" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "notCirculatingWalletTwo",
outputs: [{ internalType: "address", name: "", type: "address" }],
stateMutability: "view",
type: "function"
},
{
inputs: [
{ internalType: "address", name: "", type: "address" },
{ internalType: "address", name: "", type: "address" },
{ internalType: "uint256[]", name: "", type: "uint256[]" },
{ internalType: "uint256[]", name: "", type: "uint256[]" },
{ internalType: "bytes", name: "", type: "bytes" }
],
name: "onERC1155BatchReceived",
outputs: [{ internalType: "bytes4", name: "", type: "bytes4" }],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{ internalType: "address", name: "", type: "address" },
{ internalType: "address", name: "", type: "address" },
{ internalType: "uint256", name: "", type: "uint256" },
{ internalType: "uint256", name: "", type: "uint256" },
{ internalType: "bytes", name: "", type: "bytes" }
],
name: "onERC1155Received",
outputs: [{ internalType: "bytes4", name: "", type: "bytes4" }],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{ internalType: "address", name: "", type: "address" },
{ internalType: "address", name: "", type: "address" },
{ internalType: "uint256", name: "", type: "uint256" },
{ internalType: "bytes", name: "", type: "bytes" }
],
name: "onERC721Received",
outputs: [{ internalType: "bytes4", name: "", type: "bytes4" }],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [{ internalType: "uint256", name: "proposalId", type: "uint256" }],
name: "proposalDeadline",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "uint256", name: "proposalId", type: "uint256" }],
name: "proposalEta",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "uint256", name: "proposalId", type: "uint256" }],
name: "proposalNeedsQueuing",
outputs: [{ internalType: "bool", name: "", type: "bool" }],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "uint256", name: "proposalId", type: "uint256" }],
name: "proposalProposer",
outputs: [{ internalType: "address", name: "", type: "address" }],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "uint256", name: "proposalId", type: "uint256" }],
name: "proposalSnapshot",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "proposalThreshold",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "uint256", name: "proposalId", type: "uint256" }],
name: "proposalVotes",
outputs: [
{ internalType: "uint256", name: "againstVotes", type: "uint256" },
{ internalType: "uint256", name: "forVotes", type: "uint256" },
{ internalType: "uint256", name: "abstainVotes", type: "uint256" }
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{ internalType: "address[]", name: "targets", type: "address[]" },
{ internalType: "uint256[]", name: "values", type: "uint256[]" },
{ internalType: "bytes[]", name: "calldatas", type: "bytes[]" },
{ internalType: "string", name: "description", type: "string" }
],
name: "propose",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{ internalType: "address[]", name: "targets", type: "address[]" },
{ internalType: "uint256[]", name: "values", type: "uint256[]" },
{ internalType: "bytes[]", name: "calldatas", type: "bytes[]" },
{ internalType: "bytes32", name: "proposalDescription", type: "bytes32" }
],
name: "queue",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [{ internalType: "uint256", name: "timepoint", type: "uint256" }],
name: "quorum",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "quorumDenominator",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "uint256", name: "timepoint", type: "uint256" }],
name: "quorumNumerator",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "quorumNumerator",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "uint256", name: "proposalId", type: "uint256" }],
name: "rejectProposalAction",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{ internalType: "address", name: "target", type: "address" },
{ internalType: "uint256", name: "value", type: "uint256" },
{ internalType: "bytes", name: "data", type: "bytes" }
],
name: "relay",
outputs: [],
stateMutability: "payable",
type: "function"
},
{
inputs: [
{ internalType: "bytes32", name: "role", type: "bytes32" },
{ internalType: "address", name: "callerConfirmation", type: "address" }
],
name: "renounceRole",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{ internalType: "bytes32", name: "role", type: "bytes32" },
{ internalType: "address", name: "account", type: "address" }
],
name: "revokeRole",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
internalType: "uint256",
name: "newProposalThreshold",
type: "uint256"
}
],
name: "setProposalThreshold",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
internalType: "uint256",
name: "_newIncreaseNumerator",
type: "uint256"
}
],
name: "setQuorumIncreaseNumerator",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{ internalType: "uint48", name: "newVotingDelay", type: "uint48" }
],
name: "setVotingDelay",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{ internalType: "uint32", name: "newVotingPeriod", type: "uint32" }
],
name: "setVotingPeriod",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [{ internalType: "uint256", name: "proposalId", type: "uint256" }],
name: "state",
outputs: [
{ internalType: "enum IGovernor.ProposalState", name: "", type: "uint8" }
],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "bytes4", name: "interfaceId", type: "bytes4" }],
name: "supportsInterface",
outputs: [{ internalType: "bool", name: "", type: "bool" }],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "address[]",
name: "formerCancellers",
type: "address[]"
},
{ internalType: "address[]", name: "newCancellers", type: "address[]" }
],
name: "swapRoles",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [],
name: "timelock",
outputs: [{ internalType: "address", name: "", type: "address" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "timelockControllerAddress",
outputs: [{ internalType: "address", name: "", type: "address" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "token",
outputs: [{ internalType: "contract IERC5805", name: "", type: "address" }],
stateMutability: "view",
type: "function"
},
{
inputs: [
{ internalType: "uint256", name: "newQuorumNumerator", type: "uint256" }
],
name: "updateQuorumNumerator",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
internalType: "contract TimelockController",
name: "newTimelock",
type: "address"
}
],
name: "updateTimelock",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [],
name: "version",
outputs: [{ internalType: "string", name: "", type: "string" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "votingDelay",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "votingPeriod",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "view",
type: "function"
},
{ stateMutability: "payable", type: "receive" }
];
// src/ABI/token.ts
var tokenABI = [
{
inputs: [
{ internalType: "address", name: "MULTISIGONE", type: "address" },
{ internalType: "address", name: "MULTISIGTWO", type: "address" }
],
stateMutability: "nonpayable",
type: "constructor"
},
{ inputs: [], name: "CheckpointUnorderedInsertion", type: "error" },
{ inputs: [], name: "ECDSAInvalidSignature", type: "error" },
{
inputs: [{ internalType: "uint256", name: "length", type: "uint256" }],
name: "ECDSAInvalidSignatureLength",
type: "error"
},
{
inputs: [{ internalType: "bytes32", name: "s", type: "bytes32" }],
name: "ECDSAInvalidSignatureS",
type: "error"
},
{
inputs: [
{ internalType: "uint256", name: "increasedSupply", type: "uint256" },
{ internalType: "uint256", name: "cap", type: "uint256" }
],
name: "ERC20ExceededSafeSupply",
type: "error"
},
{
inputs: [
{ internalType: "address", name: "spender", type: "address" },
{ internalType: "uint256", name: "allowance", type: "uint256" },
{ internalType: "uint256", name: "needed", type: "uint256" }
],
name: "ERC20InsufficientAllowance",
type: "error"
},
{
inputs: [
{ internalType: "address", name: "sender", type: "address" },
{ internalType: "uint256", name: "balance", type: "uint256" },
{ internalType: "uint256", name: "needed", type: "uint256" }
],
name: "ERC20InsufficientBalance",
type: "error"
},
{
inputs: [{ internalType: "address", name: "approver", type: "address" }],
name: "ERC20InvalidApprover",
type: "error"
},
{
inputs: [{ internalType: "address", name: "receiver", type: "address" }],
name: "ERC20InvalidReceiver",
type: "error"
},
{
inputs: [{ internalType: "address", name: "sender", type: "address" }],
name: "ERC20InvalidSender",
type: "error"
},
{
inputs: [{ internalType: "address", name: "spender", type: "address" }],
name: "ERC20InvalidSpender",
type: "error"
},
{
inputs: [{ internalType: "uint256", name: "deadline", type: "uint256" }],
name: "ERC2612ExpiredSignature",
type: "error"
},
{
inputs: [
{ internalType: "address", name: "signer", type: "address" },
{ internalType: "address", name: "owner", type: "address" }
],
name: "ERC2612InvalidSigner",
type: "error"
},
{
inputs: [
{ internalType: "uint256", name: "timepoint", type: "uint256" },
{ internalType: "uint48", name: "clock", type: "uint48" }
],
name: "ERC5805FutureLookup",
type: "error"
},
{ inputs: [], name: "ERC6372InconsistentClock", type: "error" },
{
inputs: [
{ internalType: "address", name: "account", type: "address" },
{ internalType: "uint256", name: "currentNonce", type: "uint256" }
],
name: "InvalidAccountNonce",
type: "error"
},
{ inputs: [], name: "InvalidShortString", type: "error" },
{
inputs: [
{ internalType: "uint8", name: "bits", type: "uint8" },
{ internalType: "uint256", name: "value", type: "uint256" }
],
name: "SafeCastOverflowedUintDowncast",
type: "error"
},
{
inputs: [{ internalType: "string", name: "str", type: "string" }],
name: "StringTooLong",
type: "error"
},
{
inputs: [{ internalType: "uint256", name: "expiry", type: "uint256" }],
name: "VotesExpiredSignature",
type: "error"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "owner",
type: "address"
},
{
indexed: true,
internalType: "address",
name: "spender",
type: "address"
},
{
indexed: false,
internalType: "uint256",
name: "value",
type: "uint256"
}
],
name: "Approval",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "delegator",
type: "address"
},
{
indexed: true,
internalType: "address",
name: "fromDelegate",
type: "address"
},
{
indexed: true,
internalType: "address",
name: "toDelegate",
type: "address"
}
],
name: "DelegateChanged",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "delegate",
type: "address"
},
{
indexed: false,
internalType: "uint256",
name: "previousVotes",
type: "uint256"
},
{
indexed: false,
internalType: "uint256",
name: "newVotes",
type: "uint256"
}
],
name: "DelegateVotesChanged",
type: "event"
},
{ anonymous: false, inputs: [], name: "EIP712DomainChanged", type: "event" },
{
anonymous: false,
inputs: [
{ indexed: true, internalType: "address", name: "from", type: "address" },
{ indexed: true, internalType: "address", name: "to", type: "address" },
{
indexed: false,
internalType: "uint256",
name: "value",
type: "uint256"
}
],
name: "Transfer",
type: "event"
},
{
inputs: [],
name: "CLOCK_MODE",
outputs: [{ internalType: "string", name: "", type: "string" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "DOMAIN_SEPARATOR",
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
stateMutability: "view",
type: "function"
},
{
inputs: [
{ internalType: "address", name: "owner", type: "address" },
{ internalType: "address", name: "spender", type: "address" }
],
name: "allowance",
outputs: [{ internalType: