@aztec/ethereum 0.0.0-test.1 → 0.0.1-commit.b655e406
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/account.d.ts +2 -0
- package/dest/account.d.ts.map +1 -0
- package/dest/account.js +4 -0
- package/dest/client.d.ts +5 -3
- package/dest/client.d.ts.map +1 -1
- package/dest/client.js +16 -2
- package/dest/config.d.ts +107 -16
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +456 -22
- package/dest/contracts/empire_base.d.ts +21 -6
- package/dest/contracts/empire_base.d.ts.map +1 -1
- package/dest/contracts/empire_base.js +75 -2
- package/dest/contracts/empire_slashing_proposer.d.ts +65 -0
- package/dest/contracts/empire_slashing_proposer.d.ts.map +1 -0
- package/dest/contracts/empire_slashing_proposer.js +194 -0
- package/dest/contracts/errors.d.ts +7 -0
- package/dest/contracts/errors.d.ts.map +1 -0
- package/dest/contracts/errors.js +12 -0
- package/dest/contracts/fee_asset_handler.d.ts +19 -0
- package/dest/contracts/fee_asset_handler.d.ts.map +1 -0
- package/dest/contracts/fee_asset_handler.js +57 -0
- package/dest/contracts/fee_juice.d.ts +5 -6
- package/dest/contracts/fee_juice.d.ts.map +1 -1
- package/dest/contracts/fee_juice.js +27 -20
- package/dest/contracts/governance.d.ts +36 -25
- package/dest/contracts/governance.d.ts.map +1 -1
- package/dest/contracts/governance.js +87 -84
- package/dest/contracts/governance_proposer.d.ts +13 -11
- package/dest/contracts/governance_proposer.d.ts.map +1 -1
- package/dest/contracts/governance_proposer.js +32 -18
- package/dest/contracts/gse.d.ts +32 -0
- package/dest/contracts/gse.d.ts.map +1 -0
- package/dest/contracts/gse.js +72 -0
- package/dest/contracts/inbox.d.ts +26 -0
- package/dest/contracts/inbox.d.ts.map +1 -0
- package/dest/contracts/inbox.js +45 -0
- package/dest/contracts/index.d.ts +8 -2
- package/dest/contracts/index.d.ts.map +1 -1
- package/dest/contracts/index.js +8 -2
- package/dest/contracts/multicall.d.ts +21 -0
- package/dest/contracts/multicall.d.ts.map +1 -0
- package/dest/contracts/multicall.js +156 -0
- package/dest/contracts/registry.d.ts +9 -4
- package/dest/contracts/registry.d.ts.map +1 -1
- package/dest/contracts/registry.js +44 -16
- package/dest/contracts/rollup.d.ts +202 -29
- package/dest/contracts/rollup.d.ts.map +1 -1
- package/dest/contracts/rollup.js +500 -55
- package/dest/contracts/slasher_contract.d.ts +44 -0
- package/dest/contracts/slasher_contract.d.ts.map +1 -0
- package/dest/contracts/slasher_contract.js +75 -0
- package/dest/contracts/tally_slashing_proposer.d.ts +138 -0
- package/dest/contracts/tally_slashing_proposer.d.ts.map +1 -0
- package/dest/contracts/tally_slashing_proposer.js +313 -0
- package/dest/contracts/utils.d.ts +3 -0
- package/dest/contracts/utils.d.ts.map +1 -0
- package/dest/contracts/utils.js +11 -0
- package/dest/deploy_l1_contracts.d.ts +128 -21112
- package/dest/deploy_l1_contracts.d.ts.map +1 -1
- package/dest/deploy_l1_contracts.js +1204 -418
- package/dest/eth-signer/eth-signer.d.ts +21 -0
- package/dest/eth-signer/eth-signer.d.ts.map +1 -0
- package/dest/eth-signer/eth-signer.js +5 -0
- package/dest/eth-signer/index.d.ts +2 -0
- package/dest/eth-signer/index.d.ts.map +1 -0
- package/dest/eth-signer/index.js +1 -0
- package/dest/index.d.ts +6 -2
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +6 -2
- package/dest/l1_artifacts.d.ts +76184 -0
- package/dest/l1_artifacts.d.ts.map +1 -0
- package/dest/l1_artifacts.js +166 -0
- package/dest/l1_contract_addresses.d.ts +21 -1
- package/dest/l1_contract_addresses.d.ts.map +1 -1
- package/dest/l1_contract_addresses.js +22 -18
- package/dest/l1_reader.d.ts +1 -1
- package/dest/l1_reader.d.ts.map +1 -1
- package/dest/l1_reader.js +8 -8
- package/dest/l1_tx_utils/config.d.ts +59 -0
- package/dest/l1_tx_utils/config.d.ts.map +1 -0
- package/dest/l1_tx_utils/config.js +73 -0
- package/dest/l1_tx_utils/constants.d.ts +6 -0
- package/dest/l1_tx_utils/constants.d.ts.map +1 -0
- package/dest/l1_tx_utils/constants.js +14 -0
- package/dest/l1_tx_utils/factory.d.ts +24 -0
- package/dest/l1_tx_utils/factory.d.ts.map +1 -0
- package/dest/l1_tx_utils/factory.js +12 -0
- package/dest/l1_tx_utils/index.d.ts +10 -0
- package/dest/l1_tx_utils/index.d.ts.map +1 -0
- package/dest/l1_tx_utils/index.js +10 -0
- package/dest/l1_tx_utils/interfaces.d.ts +76 -0
- package/dest/l1_tx_utils/interfaces.d.ts.map +1 -0
- package/dest/l1_tx_utils/interfaces.js +4 -0
- package/dest/l1_tx_utils/l1_tx_utils.d.ts +95 -0
- package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -0
- package/dest/l1_tx_utils/l1_tx_utils.js +610 -0
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts +26 -0
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts.map +1 -0
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.js +26 -0
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +94 -0
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -0
- package/dest/l1_tx_utils/readonly_l1_tx_utils.js +431 -0
- package/dest/l1_tx_utils/signer.d.ts +4 -0
- package/dest/l1_tx_utils/signer.d.ts.map +1 -0
- package/dest/l1_tx_utils/signer.js +16 -0
- package/dest/l1_tx_utils/types.d.ts +67 -0
- package/dest/l1_tx_utils/types.d.ts.map +1 -0
- package/dest/l1_tx_utils/types.js +26 -0
- package/dest/l1_tx_utils/utils.d.ts +4 -0
- package/dest/l1_tx_utils/utils.d.ts.map +1 -0
- package/dest/l1_tx_utils/utils.js +14 -0
- package/dest/l1_types.d.ts +6 -0
- package/dest/l1_types.d.ts.map +1 -0
- package/dest/l1_types.js +1 -0
- package/dest/publisher_manager.d.ts +15 -0
- package/dest/publisher_manager.d.ts.map +1 -0
- package/dest/publisher_manager.js +88 -0
- package/dest/queries.d.ts +3 -1
- package/dest/queries.d.ts.map +1 -1
- package/dest/queries.js +51 -12
- package/dest/test/chain_monitor.d.ts +72 -0
- package/dest/test/chain_monitor.d.ts.map +1 -0
- package/dest/test/chain_monitor.js +216 -0
- package/dest/test/delayed_tx_utils.d.ts +7 -2
- package/dest/test/delayed_tx_utils.d.ts.map +1 -1
- package/dest/test/delayed_tx_utils.js +13 -6
- package/dest/{eth_cheat_codes.d.ts → test/eth_cheat_codes.d.ts} +87 -13
- package/dest/test/eth_cheat_codes.d.ts.map +1 -0
- package/dest/test/eth_cheat_codes.js +552 -0
- package/dest/test/eth_cheat_codes_with_state.d.ts +1 -1
- package/dest/test/eth_cheat_codes_with_state.d.ts.map +1 -1
- package/dest/test/eth_cheat_codes_with_state.js +1 -1
- package/dest/test/index.d.ts +3 -0
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/index.js +3 -0
- package/dest/test/rollup_cheat_codes.d.ts +86 -0
- package/dest/test/rollup_cheat_codes.d.ts.map +1 -0
- package/dest/test/rollup_cheat_codes.js +268 -0
- package/dest/test/start_anvil.d.ts +5 -0
- package/dest/test/start_anvil.d.ts.map +1 -1
- package/dest/test/start_anvil.js +15 -7
- package/dest/test/tx_delayer.d.ts +17 -6
- package/dest/test/tx_delayer.d.ts.map +1 -1
- package/dest/test/tx_delayer.js +95 -19
- package/dest/test/upgrade_utils.d.ts +5 -4
- package/dest/test/upgrade_utils.d.ts.map +1 -1
- package/dest/test/upgrade_utils.js +23 -16
- package/dest/types.d.ts +6 -7
- package/dest/types.d.ts.map +1 -1
- package/dest/types.js +3 -1
- package/dest/utils.d.ts +1 -0
- package/dest/utils.d.ts.map +1 -1
- package/dest/utils.js +43 -88
- package/dest/zkPassportVerifierAddress.d.ts +15 -0
- package/dest/zkPassportVerifierAddress.d.ts.map +1 -0
- package/dest/zkPassportVerifierAddress.js +11 -0
- package/package.json +24 -16
- package/src/account.ts +5 -0
- package/src/client.ts +42 -4
- package/src/config.ts +584 -31
- package/src/contracts/empire_base.ts +75 -6
- package/src/contracts/empire_slashing_proposer.ts +259 -0
- package/src/contracts/errors.ts +13 -0
- package/src/contracts/fee_asset_handler.ts +63 -0
- package/src/contracts/fee_juice.ts +29 -15
- package/src/contracts/governance.ts +80 -77
- package/src/contracts/governance_proposer.ts +60 -24
- package/src/contracts/gse.ts +88 -0
- package/src/contracts/inbox.ts +63 -0
- package/src/contracts/index.ts +8 -2
- package/src/contracts/multicall.ts +155 -0
- package/src/contracts/registry.ts +51 -26
- package/src/contracts/rollup.ts +585 -56
- package/src/contracts/slasher_contract.ts +89 -0
- package/src/contracts/tally_slashing_proposer.ts +315 -0
- package/src/contracts/utils.ts +14 -0
- package/src/deploy_l1_contracts.ts +1467 -566
- package/src/eth-signer/eth-signer.ts +25 -0
- package/src/eth-signer/index.ts +1 -0
- package/src/index.ts +6 -2
- package/src/l1_artifacts.ts +254 -0
- package/src/l1_contract_addresses.ts +32 -19
- package/src/l1_reader.ts +9 -9
- package/src/l1_tx_utils/README.md +177 -0
- package/src/l1_tx_utils/config.ts +140 -0
- package/src/l1_tx_utils/constants.ts +18 -0
- package/src/l1_tx_utils/factory.ts +64 -0
- package/src/l1_tx_utils/index.ts +12 -0
- package/src/l1_tx_utils/interfaces.ts +86 -0
- package/src/l1_tx_utils/l1_tx_utils.ts +718 -0
- package/src/l1_tx_utils/l1_tx_utils_with_blobs.ts +77 -0
- package/src/l1_tx_utils/readonly_l1_tx_utils.ts +559 -0
- package/src/l1_tx_utils/signer.ts +28 -0
- package/src/l1_tx_utils/types.ts +85 -0
- package/src/l1_tx_utils/utils.ts +16 -0
- package/src/l1_types.ts +6 -0
- package/src/publisher_manager.ts +106 -0
- package/src/queries.ts +70 -15
- package/src/test/chain_monitor.ts +243 -0
- package/src/test/delayed_tx_utils.ts +34 -6
- package/src/test/eth_cheat_codes.ts +582 -0
- package/src/test/eth_cheat_codes_with_state.ts +1 -1
- package/src/test/index.ts +3 -0
- package/src/test/rollup_cheat_codes.ts +310 -0
- package/src/test/start_anvil.ts +20 -5
- package/src/test/tx_delayer.ts +127 -26
- package/src/test/upgrade_utils.ts +30 -21
- package/src/types.ts +10 -8
- package/src/utils.ts +49 -90
- package/src/zkPassportVerifierAddress.ts +15 -0
- package/dest/contracts/forwarder.d.ts +0 -24
- package/dest/contracts/forwarder.d.ts.map +0 -1
- package/dest/contracts/forwarder.js +0 -101
- package/dest/contracts/slashing_proposer.d.ts +0 -21
- package/dest/contracts/slashing_proposer.d.ts.map +0 -1
- package/dest/contracts/slashing_proposer.js +0 -47
- package/dest/eth_cheat_codes.d.ts.map +0 -1
- package/dest/eth_cheat_codes.js +0 -303
- package/dest/l1_tx_utils.d.ts +0 -192
- package/dest/l1_tx_utils.d.ts.map +0 -1
- package/dest/l1_tx_utils.js +0 -641
- package/dest/l1_tx_utils_with_blobs.d.ts +0 -12
- package/dest/l1_tx_utils_with_blobs.d.ts.map +0 -1
- package/dest/l1_tx_utils_with_blobs.js +0 -64
- package/src/contracts/forwarder.ts +0 -132
- package/src/contracts/slashing_proposer.ts +0 -51
- package/src/eth_cheat_codes.ts +0 -314
- package/src/l1_tx_utils.ts +0 -847
- package/src/l1_tx_utils_with_blobs.ts +0 -86
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
+
import EventEmitter from 'events';
|
|
3
|
+
import { type Hex, type Log, type TypedDataDefinition } from 'viem';
|
|
4
|
+
import type { L1TxRequest, L1TxUtils } from '../l1_tx_utils/index.js';
|
|
5
|
+
import type { ViemClient } from '../types.js';
|
|
6
|
+
import { type IEmpireBase } from './empire_base.js';
|
|
7
|
+
export declare class ProposalAlreadyExecutedError extends Error {
|
|
8
|
+
constructor(round: bigint);
|
|
9
|
+
}
|
|
10
|
+
export declare class EmpireSlashingProposerContract extends EventEmitter implements IEmpireBase {
|
|
11
|
+
readonly client: ViemClient;
|
|
12
|
+
private readonly logger;
|
|
13
|
+
private readonly proposer;
|
|
14
|
+
readonly type: "empire";
|
|
15
|
+
constructor(client: ViemClient, address: Hex | EthAddress);
|
|
16
|
+
get address(): EthAddress;
|
|
17
|
+
getQuorumSize(): Promise<bigint>;
|
|
18
|
+
getRoundSize(): Promise<bigint>;
|
|
19
|
+
getLifetimeInRounds(): Promise<bigint>;
|
|
20
|
+
getExecutionDelayInRounds(): Promise<bigint>;
|
|
21
|
+
getCurrentRound(): Promise<bigint>;
|
|
22
|
+
computeRound(slot: bigint): Promise<bigint>;
|
|
23
|
+
getInstance(): Promise<`0x${string}`>;
|
|
24
|
+
getRoundInfo(rollupAddress: Hex, round: bigint): Promise<{
|
|
25
|
+
lastSignalSlot: bigint;
|
|
26
|
+
payloadWithMostSignals: Hex;
|
|
27
|
+
executed: boolean;
|
|
28
|
+
}>;
|
|
29
|
+
getPayloadSignals(rollupAddress: Hex, round: bigint, payload: Hex): Promise<bigint>;
|
|
30
|
+
createSignalRequest(payload: Hex): L1TxRequest;
|
|
31
|
+
createSignalRequestWithSignature(payload: Hex, slot: bigint, chainId: number, signerAddress: Hex, signer: (msg: TypedDataDefinition) => Promise<Hex>): Promise<L1TxRequest>;
|
|
32
|
+
listenToSubmittablePayloads(callback: (args: {
|
|
33
|
+
payload: `0x${string}`;
|
|
34
|
+
round: bigint;
|
|
35
|
+
}) => unknown): import("viem").WatchContractEventReturnType;
|
|
36
|
+
listenToPayloadSubmitted(callback: (args: {
|
|
37
|
+
round: bigint;
|
|
38
|
+
payload: `0x${string}`;
|
|
39
|
+
}) => unknown): import("viem").WatchContractEventReturnType;
|
|
40
|
+
listenToSignalCasted(callback: (args: {
|
|
41
|
+
round: bigint;
|
|
42
|
+
payload: `0x${string}`;
|
|
43
|
+
signaler: `0x${string}`;
|
|
44
|
+
}) => unknown): import("viem").WatchContractEventReturnType;
|
|
45
|
+
/** Creates an L1TxRequest to submit the round winner for the given round. */
|
|
46
|
+
buildExecuteRoundRequest(round: bigint): L1TxRequest;
|
|
47
|
+
/** Tries to extract a PayloadSubmitted event from the given logs. */
|
|
48
|
+
tryExtractPayloadSubmittedEvent(logs: Log[]): {
|
|
49
|
+
eventName: "PayloadSubmitted";
|
|
50
|
+
args: {
|
|
51
|
+
payload: `0x${string}`;
|
|
52
|
+
round: bigint;
|
|
53
|
+
};
|
|
54
|
+
} | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Wait for a round to be reached.
|
|
57
|
+
*
|
|
58
|
+
* @param round - The round to wait for.
|
|
59
|
+
* @param pollingIntervalSeconds - The interval in seconds to poll for the round.
|
|
60
|
+
* @returns True if the round was reached, false otherwise.
|
|
61
|
+
*/
|
|
62
|
+
waitForRound(round: bigint, pollingIntervalSeconds?: number): Promise<boolean>;
|
|
63
|
+
executeRound(txUtils: L1TxUtils, round: bigint | number): ReturnType<typeof txUtils.sendAndMonitorTransaction>;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=empire_slashing_proposer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"empire_slashing_proposer.d.ts","sourceRoot":"","sources":["../../src/contracts/empire_slashing_proposer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAK3D,OAAO,YAAY,MAAM,QAAQ,CAAC;AAClC,OAAO,EAGL,KAAK,GAAG,EACR,KAAK,GAAG,EACR,KAAK,mBAAmB,EAGzB,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,KAAK,WAAW,EAA8D,MAAM,kBAAkB,CAAC;AAEhH,qBAAa,4BAA6B,SAAQ,KAAK;gBACzC,KAAK,EAAE,MAAM;CAG1B;AAED,qBAAa,8BAA+B,SAAQ,YAAa,YAAW,WAAW;aAOnE,MAAM,EAAE,UAAU;IANpC,OAAO,CAA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Q,EAAE,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,KAAK,MAAM,EAAE,CAAC;QAAC,QAAQ,EAAE,KAAK,MAAM,EAAE,CAAA;KAAE,KAAK,OAAO;IAiBjG,6EAA6E;IACtE,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW;IAW3D,qEAAqE;IAC9D,+BAA+B,CAAC,IAAI,EAAE,GAAG,EAAE;;;;;;;IAIlD;;;;;;OAMG;IACI,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,sBAAsB,GAAE,MAAU,GAAG,OAAO,CAAC,OAAO,CAAC;IAe3E,YAAY,CACvB,OAAO,EAAE,SAAS,EAClB,KAAK,EAAE,MAAM,GAAG,MAAM,GACrB,UAAU,CAAC,OAAO,OAAO,CAAC,yBAAyB,CAAC;CAiDxD"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
3
|
+
import { retryUntil } from '@aztec/foundation/retry';
|
|
4
|
+
import { EmpireSlashingProposerAbi } from '@aztec/l1-artifacts/EmpireSlashingProposerAbi';
|
|
5
|
+
import EventEmitter from 'events';
|
|
6
|
+
import { encodeFunctionData, getContract } from 'viem';
|
|
7
|
+
import { FormattedViemError, tryExtractEvent } from '../utils.js';
|
|
8
|
+
import { encodeSignal, encodeSignalWithSignature, signSignalWithSig } from './empire_base.js';
|
|
9
|
+
export class ProposalAlreadyExecutedError extends Error {
|
|
10
|
+
constructor(round){
|
|
11
|
+
super(`Proposal already executed: ${round}`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export class EmpireSlashingProposerContract extends EventEmitter {
|
|
15
|
+
client;
|
|
16
|
+
logger;
|
|
17
|
+
proposer;
|
|
18
|
+
type;
|
|
19
|
+
constructor(client, address){
|
|
20
|
+
super(), this.client = client, this.logger = createLogger('ethereum:contracts:empire_slashing_proposer'), this.type = 'empire';
|
|
21
|
+
this.proposer = getContract({
|
|
22
|
+
address: typeof address === 'string' ? address : address.toString(),
|
|
23
|
+
abi: EmpireSlashingProposerAbi,
|
|
24
|
+
client
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
get address() {
|
|
28
|
+
return EthAddress.fromString(this.proposer.address);
|
|
29
|
+
}
|
|
30
|
+
getQuorumSize() {
|
|
31
|
+
return this.proposer.read.QUORUM_SIZE();
|
|
32
|
+
}
|
|
33
|
+
getRoundSize() {
|
|
34
|
+
return this.proposer.read.ROUND_SIZE();
|
|
35
|
+
}
|
|
36
|
+
getLifetimeInRounds() {
|
|
37
|
+
return this.proposer.read.LIFETIME_IN_ROUNDS();
|
|
38
|
+
}
|
|
39
|
+
getExecutionDelayInRounds() {
|
|
40
|
+
return this.proposer.read.EXECUTION_DELAY_IN_ROUNDS();
|
|
41
|
+
}
|
|
42
|
+
getCurrentRound() {
|
|
43
|
+
return this.proposer.read.getCurrentRound();
|
|
44
|
+
}
|
|
45
|
+
computeRound(slot) {
|
|
46
|
+
return this.proposer.read.computeRound([
|
|
47
|
+
slot
|
|
48
|
+
]);
|
|
49
|
+
}
|
|
50
|
+
getInstance() {
|
|
51
|
+
return this.proposer.read.getInstance();
|
|
52
|
+
}
|
|
53
|
+
async getRoundInfo(rollupAddress, round) {
|
|
54
|
+
return await this.proposer.read.getRoundData([
|
|
55
|
+
rollupAddress,
|
|
56
|
+
round
|
|
57
|
+
]);
|
|
58
|
+
}
|
|
59
|
+
getPayloadSignals(rollupAddress, round, payload) {
|
|
60
|
+
return this.proposer.read.signalCount([
|
|
61
|
+
rollupAddress,
|
|
62
|
+
round,
|
|
63
|
+
payload
|
|
64
|
+
]);
|
|
65
|
+
}
|
|
66
|
+
createSignalRequest(payload) {
|
|
67
|
+
return {
|
|
68
|
+
to: this.address.toString(),
|
|
69
|
+
data: encodeSignal(payload)
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
async createSignalRequestWithSignature(payload, slot, chainId, signerAddress, signer) {
|
|
73
|
+
const signature = await signSignalWithSig(signer, payload, slot, await this.getInstance(), this.address.toString(), chainId);
|
|
74
|
+
return {
|
|
75
|
+
to: this.address.toString(),
|
|
76
|
+
data: encodeSignalWithSignature(payload, signature)
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
listenToSubmittablePayloads(callback) {
|
|
80
|
+
return this.proposer.watchEvent.PayloadSubmittable({}, {
|
|
81
|
+
strict: true,
|
|
82
|
+
onLogs: (logs)=>{
|
|
83
|
+
for (const log of logs){
|
|
84
|
+
const { payload, round } = log.args;
|
|
85
|
+
if (payload && round) {
|
|
86
|
+
callback({
|
|
87
|
+
payload,
|
|
88
|
+
round
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
listenToPayloadSubmitted(callback) {
|
|
96
|
+
return this.proposer.watchEvent.PayloadSubmitted({}, {
|
|
97
|
+
onLogs: (logs)=>{
|
|
98
|
+
for (const log of logs){
|
|
99
|
+
const { payload, round } = log.args;
|
|
100
|
+
if (round && payload) {
|
|
101
|
+
callback({
|
|
102
|
+
round,
|
|
103
|
+
payload
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
listenToSignalCasted(callback) {
|
|
111
|
+
return this.proposer.watchEvent.SignalCast({}, {
|
|
112
|
+
onLogs: (logs)=>{
|
|
113
|
+
for (const log of logs){
|
|
114
|
+
const { round, payload, signaler } = log.args;
|
|
115
|
+
if (round && payload && signaler) {
|
|
116
|
+
callback({
|
|
117
|
+
round,
|
|
118
|
+
payload,
|
|
119
|
+
signaler
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
/** Creates an L1TxRequest to submit the round winner for the given round. */ buildExecuteRoundRequest(round) {
|
|
127
|
+
return {
|
|
128
|
+
to: this.address.toString(),
|
|
129
|
+
data: encodeFunctionData({
|
|
130
|
+
abi: EmpireSlashingProposerAbi,
|
|
131
|
+
functionName: 'submitRoundWinner',
|
|
132
|
+
args: [
|
|
133
|
+
round
|
|
134
|
+
]
|
|
135
|
+
})
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
/** Tries to extract a PayloadSubmitted event from the given logs. */ tryExtractPayloadSubmittedEvent(logs) {
|
|
139
|
+
return tryExtractEvent(logs, this.address.toString(), EmpireSlashingProposerAbi, 'PayloadSubmitted');
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Wait for a round to be reached.
|
|
143
|
+
*
|
|
144
|
+
* @param round - The round to wait for.
|
|
145
|
+
* @param pollingIntervalSeconds - The interval in seconds to poll for the round.
|
|
146
|
+
* @returns True if the round was reached, false otherwise.
|
|
147
|
+
*/ waitForRound(round, pollingIntervalSeconds = 1) {
|
|
148
|
+
return retryUntil(async ()=>{
|
|
149
|
+
const currentRound = await this.proposer.read.getCurrentRound().catch((e)=>{
|
|
150
|
+
this.logger.error('Error getting current round', e);
|
|
151
|
+
return undefined;
|
|
152
|
+
});
|
|
153
|
+
return currentRound !== undefined && currentRound >= round;
|
|
154
|
+
}, `Waiting for round ${round} to be reached`, 0, pollingIntervalSeconds).catch(()=>false);
|
|
155
|
+
}
|
|
156
|
+
async executeRound(txUtils, round) {
|
|
157
|
+
if (typeof round === 'number') {
|
|
158
|
+
round = BigInt(round);
|
|
159
|
+
}
|
|
160
|
+
const args = {
|
|
161
|
+
abi: EmpireSlashingProposerAbi,
|
|
162
|
+
functionName: 'submitRoundWinner',
|
|
163
|
+
args: [
|
|
164
|
+
round
|
|
165
|
+
]
|
|
166
|
+
};
|
|
167
|
+
const data = encodeFunctionData(args);
|
|
168
|
+
const response = await txUtils.sendAndMonitorTransaction({
|
|
169
|
+
to: this.address.toString(),
|
|
170
|
+
data
|
|
171
|
+
}, {
|
|
172
|
+
// Gas estimation is way off for this, likely because we are creating the contract/selector to call
|
|
173
|
+
// for the actual slashing dynamically.
|
|
174
|
+
gasLimitBufferPercentage: 50
|
|
175
|
+
}).catch((err)=>{
|
|
176
|
+
if (err instanceof FormattedViemError && err.message.includes('ProposalAlreadyExecuted')) {
|
|
177
|
+
throw new ProposalAlreadyExecutedError(round);
|
|
178
|
+
}
|
|
179
|
+
throw err;
|
|
180
|
+
});
|
|
181
|
+
if (response.receipt.status === 'reverted') {
|
|
182
|
+
const error = await txUtils.tryGetErrorFromRevertedTx(data, {
|
|
183
|
+
...args,
|
|
184
|
+
address: this.address.toString()
|
|
185
|
+
}, undefined, []);
|
|
186
|
+
if (error?.includes('ProposalAlreadyExecuted')) {
|
|
187
|
+
throw new ProposalAlreadyExecutedError(round);
|
|
188
|
+
}
|
|
189
|
+
const errorMessage = `Failed to execute round ${round}, TxHash: ${response.receipt.transactionHash}, Error: ${error ?? 'Unknown error'}`;
|
|
190
|
+
throw new Error(errorMessage);
|
|
191
|
+
}
|
|
192
|
+
return response;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/contracts/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM;CAIpE;AAED,qBAAa,gBAAiB,SAAQ,KAAK;;CAK1C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export class BlockTagTooOldError extends Error {
|
|
2
|
+
constructor(blockTag, latestBlock){
|
|
3
|
+
super(`Block tag ${blockTag} is more than 128 blocks behind the latest block ${latestBlock}`);
|
|
4
|
+
this.name = 'BlockTagTooOldError';
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export class NoCommitteeError extends Error {
|
|
8
|
+
constructor(){
|
|
9
|
+
super('The committee does not exist on L1');
|
|
10
|
+
this.name = 'NoCommitteeError';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
+
import { type Hex } from 'viem';
|
|
3
|
+
import type { L1TxUtils } from '../l1_tx_utils/index.js';
|
|
4
|
+
export declare class FeeAssetHandlerContract {
|
|
5
|
+
readonly txUtils: L1TxUtils;
|
|
6
|
+
address: EthAddress;
|
|
7
|
+
constructor(address: Hex | EthAddress, txUtils: L1TxUtils);
|
|
8
|
+
getOwner(): Promise<EthAddress>;
|
|
9
|
+
getMintAmount(): Promise<bigint>;
|
|
10
|
+
mint(recipient: Hex | EthAddress): Promise<{
|
|
11
|
+
receipt: import("viem").TransactionReceipt;
|
|
12
|
+
state: import("../l1_tx_utils/types.js").L1TxState;
|
|
13
|
+
}>;
|
|
14
|
+
setMintAmount(amount: bigint): Promise<{
|
|
15
|
+
receipt: import("viem").TransactionReceipt;
|
|
16
|
+
state: import("../l1_tx_utils/types.js").L1TxState;
|
|
17
|
+
}>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=fee_asset_handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fee_asset_handler.d.ts","sourceRoot":"","sources":["../../src/contracts/fee_asset_handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAG3D,OAAO,EAAE,KAAK,GAAG,EAAmC,MAAM,MAAM,CAAC;AAEjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzD,qBAAa,uBAAuB;aAKhB,OAAO,EAAE,SAAS;IAJ7B,OAAO,EAAE,UAAU,CAAC;gBAGzB,OAAO,EAAE,GAAG,GAAG,UAAU,EACT,OAAO,EAAE,SAAS;IAQvB,QAAQ,IAAI,OAAO,CAAC,UAAU,CAAC;IASrC,aAAa;IASb,IAAI,CAAC,SAAS,EAAE,GAAG,GAAG,UAAU;;;;IAchC,aAAa,CAAC,MAAM,EAAE,MAAM;;;;CAUpC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
+
import { FeeAssetHandlerAbi } from '@aztec/l1-artifacts/FeeAssetHandlerAbi';
|
|
3
|
+
import { encodeFunctionData, getContract } from 'viem';
|
|
4
|
+
export class FeeAssetHandlerContract {
|
|
5
|
+
txUtils;
|
|
6
|
+
address;
|
|
7
|
+
constructor(address, txUtils){
|
|
8
|
+
this.txUtils = txUtils;
|
|
9
|
+
if (address instanceof EthAddress) {
|
|
10
|
+
address = address.toString();
|
|
11
|
+
}
|
|
12
|
+
this.address = EthAddress.fromString(address);
|
|
13
|
+
}
|
|
14
|
+
async getOwner() {
|
|
15
|
+
const contract = getContract({
|
|
16
|
+
abi: FeeAssetHandlerAbi,
|
|
17
|
+
address: this.address.toString(),
|
|
18
|
+
client: this.txUtils.client
|
|
19
|
+
});
|
|
20
|
+
return EthAddress.fromString(await contract.read.owner());
|
|
21
|
+
}
|
|
22
|
+
getMintAmount() {
|
|
23
|
+
const contract = getContract({
|
|
24
|
+
abi: FeeAssetHandlerAbi,
|
|
25
|
+
address: this.address.toString(),
|
|
26
|
+
client: this.txUtils.client
|
|
27
|
+
});
|
|
28
|
+
return contract.read.mintAmount();
|
|
29
|
+
}
|
|
30
|
+
mint(recipient) {
|
|
31
|
+
if (recipient instanceof EthAddress) {
|
|
32
|
+
recipient = recipient.toString();
|
|
33
|
+
}
|
|
34
|
+
return this.txUtils.sendAndMonitorTransaction({
|
|
35
|
+
to: this.address.toString(),
|
|
36
|
+
data: encodeFunctionData({
|
|
37
|
+
abi: FeeAssetHandlerAbi,
|
|
38
|
+
functionName: 'mint',
|
|
39
|
+
args: [
|
|
40
|
+
recipient
|
|
41
|
+
]
|
|
42
|
+
})
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
setMintAmount(amount) {
|
|
46
|
+
return this.txUtils.sendAndMonitorTransaction({
|
|
47
|
+
to: this.address.toString(),
|
|
48
|
+
data: encodeFunctionData({
|
|
49
|
+
abi: FeeAssetHandlerAbi,
|
|
50
|
+
functionName: 'setMintAmount',
|
|
51
|
+
args: [
|
|
52
|
+
amount
|
|
53
|
+
]
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
2
|
import { type Hex } from 'viem';
|
|
3
|
-
import type
|
|
3
|
+
import { type ViemClient } from '../types.js';
|
|
4
4
|
export declare class FeeJuiceContract {
|
|
5
|
-
readonly
|
|
6
|
-
readonly
|
|
7
|
-
|
|
8
|
-
private readonly walletFeeJuice;
|
|
9
|
-
constructor(address: Hex, publicClient: L1Clients['publicClient'], walletClient: L1Clients['walletClient'] | undefined);
|
|
5
|
+
readonly client: ViemClient;
|
|
6
|
+
private readonly feeJuiceContract;
|
|
7
|
+
constructor(address: Hex | EthAddress, client: ViemClient);
|
|
10
8
|
get address(): EthAddress;
|
|
9
|
+
getOwner(): Promise<EthAddress>;
|
|
11
10
|
private assertWalletFeeJuice;
|
|
12
11
|
mint(to: Hex, amount: bigint): Promise<void>;
|
|
13
12
|
approve(spender: Hex, amount: bigint): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fee_juice.d.ts","sourceRoot":"","sources":["../../src/contracts/fee_juice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAG3D,OAAO,EAA8B,KAAK,GAAG,EAAe,MAAM,MAAM,CAAC;AAEzE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"fee_juice.d.ts","sourceRoot":"","sources":["../../src/contracts/fee_juice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAG3D,OAAO,EAA8B,KAAK,GAAG,EAAe,MAAM,MAAM,CAAC;AAEzE,OAAO,EAAiC,KAAK,UAAU,EAAoB,MAAM,aAAa,CAAC;AAE/F,qBAAa,gBAAgB;aAKT,MAAM,EAAE,UAAU;IAJpC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAwD;gBAGvF,OAAO,EAAE,GAAG,GAAG,UAAU,EACT,MAAM,EAAE,UAAU;IAQpC,IAAW,OAAO,eAEjB;IAEY,QAAQ,IAAI,OAAO,CAAC,UAAU,CAAC;IAI5C,OAAO,CAAC,oBAAoB;IAOf,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM;IAW5B,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM;CAUlD"}
|
|
@@ -1,33 +1,32 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
-
import { TestERC20Abi as FeeJuiceAbi } from '@aztec/l1-artifacts';
|
|
2
|
+
import { TestERC20Abi as FeeJuiceAbi } from '@aztec/l1-artifacts/TestERC20Abi';
|
|
3
3
|
import { getContract } from 'viem';
|
|
4
|
+
import { isExtendedClient } from '../types.js';
|
|
4
5
|
export class FeeJuiceContract {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
this.
|
|
6
|
+
client;
|
|
7
|
+
feeJuiceContract;
|
|
8
|
+
constructor(address, client){
|
|
9
|
+
this.client = client;
|
|
10
|
+
if (address instanceof EthAddress) {
|
|
11
|
+
address = address.toString();
|
|
12
|
+
}
|
|
13
|
+
this.feeJuiceContract = getContract({
|
|
13
14
|
address,
|
|
14
15
|
abi: FeeJuiceAbi,
|
|
15
|
-
client
|
|
16
|
+
client
|
|
16
17
|
});
|
|
17
|
-
this.walletFeeJuice = walletClient ? getContract({
|
|
18
|
-
address,
|
|
19
|
-
abi: FeeJuiceAbi,
|
|
20
|
-
client: walletClient
|
|
21
|
-
}) : undefined;
|
|
22
18
|
}
|
|
23
19
|
get address() {
|
|
24
|
-
return EthAddress.fromString(this.
|
|
20
|
+
return EthAddress.fromString(this.feeJuiceContract.address);
|
|
21
|
+
}
|
|
22
|
+
async getOwner() {
|
|
23
|
+
return EthAddress.fromString(await this.feeJuiceContract.read.owner());
|
|
25
24
|
}
|
|
26
25
|
assertWalletFeeJuice() {
|
|
27
|
-
if (!this.
|
|
26
|
+
if (!isExtendedClient(this.client)) {
|
|
28
27
|
throw new Error('Wallet client is required for this operation');
|
|
29
28
|
}
|
|
30
|
-
return this.
|
|
29
|
+
return this.feeJuiceContract;
|
|
31
30
|
}
|
|
32
31
|
async mint(to, amount) {
|
|
33
32
|
const walletFeeJuice = this.assertWalletFeeJuice();
|
|
@@ -35,9 +34,13 @@ export class FeeJuiceContract {
|
|
|
35
34
|
to,
|
|
36
35
|
amount
|
|
37
36
|
]);
|
|
38
|
-
await this.
|
|
37
|
+
const receipt = await this.client.waitForTransactionReceipt({
|
|
39
38
|
hash: tx
|
|
40
39
|
});
|
|
40
|
+
if (receipt.status === 'success') {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
throw new Error('Mint failed');
|
|
41
44
|
}
|
|
42
45
|
async approve(spender, amount) {
|
|
43
46
|
const walletFeeJuice = this.assertWalletFeeJuice();
|
|
@@ -45,8 +48,12 @@ export class FeeJuiceContract {
|
|
|
45
48
|
spender,
|
|
46
49
|
amount
|
|
47
50
|
]);
|
|
48
|
-
await this.
|
|
51
|
+
const receipt = await this.client.waitForTransactionReceipt({
|
|
49
52
|
hash: tx
|
|
50
53
|
});
|
|
54
|
+
if (receipt.status === 'success') {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
throw new Error('Approve failed');
|
|
51
58
|
}
|
|
52
59
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
2
|
import type { Logger } from '@aztec/foundation/log';
|
|
3
|
-
import {
|
|
3
|
+
import { GovernanceAbi } from '@aztec/l1-artifacts/GovernanceAbi';
|
|
4
|
+
import { type GetContractReturnType, type Hex, type Log } from 'viem';
|
|
4
5
|
import type { L1ContractAddresses } from '../l1_contract_addresses.js';
|
|
5
|
-
import type
|
|
6
|
-
import { GovernanceProposerContract } from './governance_proposer.js';
|
|
6
|
+
import { type ExtendedViemWalletClient, type ViemClient } from '../types.js';
|
|
7
7
|
export type L1GovernanceContractAddresses = Pick<L1ContractAddresses, 'governanceAddress' | 'rollupAddress' | 'registryAddress' | 'governanceProposerAddress'>;
|
|
8
8
|
export declare enum ProposalState {
|
|
9
9
|
Pending = 0,
|
|
@@ -15,45 +15,46 @@ export declare enum ProposalState {
|
|
|
15
15
|
Dropped = 6,
|
|
16
16
|
Expired = 7
|
|
17
17
|
}
|
|
18
|
-
export declare
|
|
19
|
-
|
|
20
|
-
readonly
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
constructor(address: Hex, publicClient: ViemPublicClient, walletClient: ViemWalletClient | undefined);
|
|
18
|
+
export declare function extractProposalIdFromLogs(logs: Log[]): bigint;
|
|
19
|
+
export declare class ReadOnlyGovernanceContract {
|
|
20
|
+
readonly client: ViemClient;
|
|
21
|
+
protected readonly governanceContract: GetContractReturnType<typeof GovernanceAbi, ViemClient>;
|
|
22
|
+
constructor(address: Hex, client: ViemClient);
|
|
24
23
|
get address(): EthAddress;
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
getGovernanceProposerAddress(): Promise<EthAddress>;
|
|
25
|
+
getConfiguration(): Promise<{
|
|
26
|
+
proposeConfig: {
|
|
27
|
+
lockDelay: bigint;
|
|
28
|
+
lockAmount: bigint;
|
|
29
|
+
};
|
|
30
|
+
votingDelay: bigint;
|
|
31
|
+
votingDuration: bigint;
|
|
32
|
+
executionDelay: bigint;
|
|
33
|
+
gracePeriod: bigint;
|
|
34
|
+
quorum: bigint;
|
|
35
|
+
requiredYeaMargin: bigint;
|
|
36
|
+
minimumVotes: bigint;
|
|
37
|
+
}>;
|
|
27
38
|
getProposal(proposalId: bigint): Promise<{
|
|
28
39
|
config: {
|
|
29
|
-
proposeConfig: {
|
|
30
|
-
lockDelay: bigint;
|
|
31
|
-
lockAmount: bigint;
|
|
32
|
-
};
|
|
33
40
|
votingDelay: bigint;
|
|
34
41
|
votingDuration: bigint;
|
|
35
42
|
executionDelay: bigint;
|
|
36
43
|
gracePeriod: bigint;
|
|
37
44
|
quorum: bigint;
|
|
38
|
-
|
|
45
|
+
requiredYeaMargin: bigint;
|
|
39
46
|
minimumVotes: bigint;
|
|
40
47
|
};
|
|
41
|
-
|
|
48
|
+
cachedState: number;
|
|
42
49
|
payload: `0x${string}`;
|
|
43
|
-
|
|
50
|
+
proposer: `0x${string}`;
|
|
44
51
|
creation: bigint;
|
|
45
52
|
summedBallot: {
|
|
46
53
|
yea: bigint;
|
|
47
|
-
|
|
54
|
+
nay: bigint;
|
|
48
55
|
};
|
|
49
56
|
}>;
|
|
50
57
|
getProposalState(proposalId: bigint): Promise<ProposalState>;
|
|
51
|
-
private assertWalletGovernance;
|
|
52
|
-
deposit(onBehalfOf: Hex, amount: bigint): Promise<void>;
|
|
53
|
-
proposeWithLock({ payloadAddress, withdrawAddress, }: {
|
|
54
|
-
payloadAddress: Hex;
|
|
55
|
-
withdrawAddress: Hex;
|
|
56
|
-
}): Promise<number>;
|
|
57
58
|
awaitProposalActive({ proposalId, logger }: {
|
|
58
59
|
proposalId: bigint;
|
|
59
60
|
logger: Logger;
|
|
@@ -62,6 +63,16 @@ export declare class GovernanceContract {
|
|
|
62
63
|
proposalId: bigint;
|
|
63
64
|
logger: Logger;
|
|
64
65
|
}): Promise<void>;
|
|
66
|
+
}
|
|
67
|
+
export declare class GovernanceContract extends ReadOnlyGovernanceContract {
|
|
68
|
+
readonly client: ExtendedViemWalletClient;
|
|
69
|
+
protected readonly governanceContract: GetContractReturnType<typeof GovernanceAbi, ExtendedViemWalletClient>;
|
|
70
|
+
constructor(address: Hex | EthAddress, client: ExtendedViemWalletClient);
|
|
71
|
+
deposit(onBehalfOf: Hex, amount: bigint): Promise<void>;
|
|
72
|
+
proposeWithLock({ payloadAddress, withdrawAddress, }: {
|
|
73
|
+
payloadAddress: Hex;
|
|
74
|
+
withdrawAddress: Hex;
|
|
75
|
+
}): Promise<bigint>;
|
|
65
76
|
getPower(): Promise<bigint>;
|
|
66
77
|
vote({ proposalId, voteAmount, inFavor, retries, logger, }: {
|
|
67
78
|
proposalId: bigint;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"governance.d.ts","sourceRoot":"","sources":["../../src/contracts/governance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"governance.d.ts","sourceRoot":"","sources":["../../src/contracts/governance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAElE,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,GAAG,EACR,KAAK,GAAG,EAIT,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAEvE,OAAO,EAAE,KAAK,wBAAwB,EAAE,KAAK,UAAU,EAAoB,MAAM,aAAa,CAAC;AAE/F,MAAM,MAAM,6BAA6B,GAAG,IAAI,CAC9C,mBAAmB,EACnB,mBAAmB,GAAG,eAAe,GAAG,iBAAiB,GAAG,2BAA2B,CACxF,CAAC;AAGF,oBAAY,aAAa;IACvB,OAAO,IAAA;IACP,MAAM,IAAA;IACN,MAAM,IAAA;IAC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