Skip to content

Commit

Permalink
chore: fully migrated to hardhat
Browse files Browse the repository at this point in the history
  • Loading branch information
Orlando committed Sep 2, 2023
1 parent 0a69f52 commit 6499717
Showing 1 changed file with 18 additions and 29 deletions.
47 changes: 18 additions & 29 deletions starknet/test/l1-execution.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ describe('L1 Avatar Execution', function () {

// Using both a starknet hardhat and sn.js account wrapper as hardhat has cleaner deployment flow
// but sn.js has cleaner contract interactions. Syntax is being integrated soon.
let account: Account;
let accountSH: starknet.starknetAccount;
let starkTxAuthenticator: starknet.StarknetContract;
let vanillaVotingStrategy: starknet.StarknetContract;
Expand All @@ -48,14 +47,6 @@ describe('L1 Avatar Execution', function () {
account_pk,
);

account = new Account(
new Provider({ sequencer: { baseUrl: stark_network } }),
account_address,
account_pk,
);



const starkTxAuthenticatorFactory = await starknet.getContractFactory(
'sx_StarkTxAuthenticator',
);
Expand Down Expand Up @@ -127,9 +118,7 @@ describe('L1 Avatar Execution', function () {
ethRelayer.address,
quorum,
));
console.log('loading l1 messaging contract')
await starknet.devnet.loadL1MessagingContract(eth_network, mockStarknetMessaging.address);
console.log('loaded l1 messaging contract')

// Dumping the Starknet state so it can be loaded at the same point for each test
await starknet.devnet.dump('dump.pkl');
console.log('setup done');
Expand Down Expand Up @@ -169,48 +158,48 @@ describe('L1 Avatar Execution', function () {
console.log('proposing');

// Propose
await account.execute({
contractAddress: starkTxAuthenticator.address,
entrypoint: 'authenticate_propose',
calldata: CallData.compile({
await accountSH.invoke(
starkTxAuthenticator,
'authenticate_propose',
CallData.compile({
space: space.address,
author: account.address,
author: accountSH.address,
executionStrategy: {
address: ethRelayer.address,
params: executionPayload,
},
userProposalValidationParams: [],
metadataURI: [],
}),
});
{ rawInput: true });

// Vote
await account.execute({
contractAddress: starkTxAuthenticator.address,
entrypoint: 'authenticate_vote',
calldata: CallData.compile({
await accountSH.invoke(
starkTxAuthenticator,
'authenticate_vote',
CallData.compile({
space: space.address,
voter: account.address,
voter: accountSH.address,
proposalId: { low: '0x1', high: '0x0' },
choice: '0x1',
userVotingStrategies: [{ index: '0x0', params: [] }],
metadataURI: [],
}),
});
{ rawInput: true });

// TODO: Advance time so that the maxVotingTimestamp is exceeded
await starknet.devnet.increaseTime(10);
await sleep(10000);

// Execute
await account.execute({
contractAddress: space.address,
entrypoint: 'execute',
calldata: CallData.compile({
await accountSH.invoke(
space,
'execute',
CallData.compile({
proposalId: { low: '0x1', high: '0x0' },
executionPayload: executionPayload,
}),
});
{ rawInput: true });

// Propogating message to L1
const flushL2Response = await starknet.devnet.flush();
Expand Down

0 comments on commit 6499717

Please sign in to comment.