Skip to content

Commit

Permalink
feat: fetch remote proposals
Browse files Browse the repository at this point in the history
  • Loading branch information
therealemjy committed Oct 4, 2024
1 parent 501dc59 commit 7a57307
Show file tree
Hide file tree
Showing 63 changed files with 4,152 additions and 4,904 deletions.
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"editor.codeActionsOnSave": {
"source.organizeImports.biome": "explicit"
}
}
4 changes: 2 additions & 2 deletions apps/evm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"extract-translations": "yarn i18next",
"generate-subgraph-types:isolated-pools": "yarn graphql-codegen --config src/config/codegen.ts --project isolatedPools",
"generate-subgraph-types:governance-bsc": "yarn graphql-codegen --config src/config/codegen.ts --project governanceBsc",
"generate-subgraph-types:governance-remote-chains": "yarn graphql-codegen --config src/config/codegen.ts --project governanceRemoteChains",
"generate-subgraph-types": "npm-run-all --parallel generate-subgraph-types:isolated-pools generate-subgraph-types:governance-bsc",
"generate-subgraph-types:governance-non-bsc": "yarn graphql-codegen --config src/config/codegen.ts --project governanceNonBsc",
"generate-subgraph-types": "npm-run-all --parallel generate-subgraph-types:isolated-pools generate-subgraph-types:governance-bsc generate-subgraph-types:governance-non-bsc",
"generate-contracts": "rimraf src/libs/contracts/generated/getters && rimraf src/libs/contracts/generated/infos && src/libs/contracts/scripts/generateContractRecords/index.ts && yarn biome format --vcs-use-ignore-file=false --write src/libs/contracts/generated",
"generate-pancake-swap-tokens": "src/libs/tokens/scripts/generatePancakeSwapTokenRecords/index.ts && yarn biome format --vcs-use-ignore-file=false --write src/libs/tokens/generated/pancakeSwapTokens/bscMainnet.ts",
"generate-token-accent-colors": "src/libs/tokens/scripts/generateTokenAccentColors/index.ts && yarn biome format --vcs-use-ignore-file=false --write src/libs/tokens/generated/tokenAccentColors.ts",
Expand Down
46 changes: 9 additions & 37 deletions apps/evm/src/__mocks__/models/proposals.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import BigNumber from 'bignumber.js';
import type { Proposal } from 'types';
import { remoteProposals } from './remoteProposals';

const proposals = [
export const proposals: Proposal[] = [
{
abstainedVotesMantissa: new BigNumber('0'),
againstVotesMantissa: new BigNumber('0'),
Expand All @@ -10,12 +12,6 @@ const proposals = [
title: 'VIP Comptroller Diamond proxy',
description:
'This vip implement diamond proxy for the comptroller to divide the comptroller logic into facets. The current implementation of the comptroller is exceeding the max limit of the contract size. To resolve this diamond proxy is implemented.',
forDescription:
'I agree that Venus Protocol should proceed with the upgrading the Comptroller contract with diamond proxy',
againstDescription:
'I do not think that Venus Protocol should proceed with the Comptroller contract upgradation',
abstainDescription:
'I am indifferent to whether Venus Protocol proceeds with the Comptroller upgradation or not',
},
endBlock: 33499859,
endDate: new Date('2023-09-20T07:54:35.000Z'),
Expand All @@ -32,15 +28,14 @@ const proposals = [
proposalId: 98,
address: '0x2ce1d0ffd7e869d9df33e28552b12ddded326706',
support: 1,
blockNumber: 33335869,
blockTimestamp: new Date('1970-01-20T14:45:04.478Z'),
votesMantissa: new BigNumber('605461000000000000000000'),
reason: '',
},
],
againstVotes: [],
abstainVotes: [],
proposalType: 0,
remoteProposals,
},
{
abstainedVotesMantissa: new BigNumber('500000000000000000000000'),
Expand All @@ -51,12 +46,6 @@ const proposals = [
title: 'VIP Comptroller Diamond proxy',
description:
'This vip implement diamond proxy for the comptroller to divide the comptroller logic into facets. The current implementation of the comptroller is exceeding the max limit of the contract size. To resolve this diamond proxy is implemented.',
forDescription:
'I agree that Venus Protocol should proceed with the upgrading the Comptroller contract with diamond proxy',
againstDescription:
'I do not think that Venus Protocol should proceed with the Comptroller contract upgradation',
abstainDescription:
'I am indifferent to whether Venus Protocol proceeds with the Comptroller upgradation or not',
},
endBlock: 33499859,
endDate: new Date('2023-09-20T07:54:35.000Z'),
Expand All @@ -73,8 +62,6 @@ const proposals = [
proposalId: 97,
address: '0xc444949e0054a23c44fc45789738bdf64aed2391',
support: 1,
blockNumber: 33335869,
blockTimestamp: new Date('1970-01-20T14:45:04.478Z'),
votesMantissa: new BigNumber('605461000000000000000000'),
reason: 'yes',
},
Expand All @@ -84,8 +71,6 @@ const proposals = [
proposalId: 97,
address: '0x60277add339d936c4ab907376afee4f7ac17d760',
support: 0,
blockNumber: 33335869,
blockTimestamp: new Date('1970-01-20T14:45:04.478Z'),
votesMantissa: new BigNumber('500000000000000000000000'),
reason: 'no',
},
Expand All @@ -95,13 +80,12 @@ const proposals = [
proposalId: 97,
address: '0xb98fa0292e2927018c03ad5110673b7daa1424a7',
support: 2,
blockNumber: 33335869,
blockTimestamp: new Date('1970-01-20T14:45:04.478Z'),
votesMantissa: new BigNumber('500000000000000000000000'),
reason: 'abstain',
},
],
proposalType: 0,
remoteProposals,
},
{
abstainedVotesMantissa: new BigNumber('0'),
Expand All @@ -113,12 +97,6 @@ const proposals = [
title: 'VIP Comptroller Diamond proxy',
description:
'This vip implement diamond proxy for the comptroller to divide the comptroller logic into facets. The current implementation of the comptroller is exceeding the max limit of the contract size. To resolve this diamond proxy is implemented.',
forDescription:
'I agree that Venus Protocol should proceed with the upgrading the Comptroller contract with diamond proxy',
againstDescription:
'I do not think that Venus Protocol should proceed with the Comptroller contract upgradation',
abstainDescription:
'I am indifferent to whether Venus Protocol proceeds with the Comptroller upgradation or not',
},
endBlock: 33446667,
endDate: new Date('2023-09-18T11:34:41.000Z'),
Expand All @@ -139,15 +117,14 @@ const proposals = [
proposalId: 96,
address: '0x2ce1d0ffd7e869d9df33e28552b12ddded326706',
support: 1,
blockNumber: 33335869,
blockTimestamp: new Date('1970-01-20T14:45:04.478Z'),
votesMantissa: new BigNumber('605461000000000000000000'),
reason: '',
},
],
againstVotes: [],
abstainVotes: [],
proposalType: 0,
remoteProposals,
},
{
abstainedVotesMantissa: new BigNumber('0'),
Expand Down Expand Up @@ -176,15 +153,14 @@ const proposals = [
proposalId: 95,
address: '0x2ce1d0ffd7e869d9df33e28552b12ddded326706',
support: 1,
blockNumber: 33335869,
blockTimestamp: new Date('1970-01-20T14:45:04.478Z'),
votesMantissa: new BigNumber('605461000000000000000000'),
reason: '',
},
],
againstVotes: [],
abstainVotes: [],
proposalType: 0,
remoteProposals,
},
{
abstainedVotesMantissa: new BigNumber('0'),
Expand Down Expand Up @@ -213,15 +189,14 @@ const proposals = [
proposalId: 94,
address: '0x2ce1d0ffd7e869d9df33e28552b12ddded326706',
support: 1,
blockNumber: 33335869,
blockTimestamp: new Date('1970-01-20T14:45:04.478Z'),
votesMantissa: new BigNumber('605461000000000000000000'),
reason: '',
},
],
againstVotes: [],
abstainVotes: [],
proposalType: 0,
remoteProposals,
},
{
abstainedVotesMantissa: new BigNumber('0'),
Expand Down Expand Up @@ -250,16 +225,13 @@ const proposals = [
proposalId: 93,
address: '0x2ce1d0ffd7e869d9df33e28552b12ddded326706',
support: 1,
blockNumber: 33335869,
blockTimestamp: new Date('1970-01-20T14:45:04.478Z'),
votesMantissa: new BigNumber('605461000000000000000000'),
reason: '',
},
],
againstVotes: [],
abstainVotes: [],
proposalType: 0,
remoteProposals,
},
];

export default proposals;
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { ChainId, type ProposalCommand, ProposalCommandState } from 'types';
import { ChainId, type RemoteProposal, RemoteProposalState } from 'types';

const fakePastDate = new Date(2023, 1, 1);
const fakeFutureDate = new Date(2089, 1, 1);

export const commands: ProposalCommand[] = [
export const remoteProposals: RemoteProposal[] = [
{
proposalId: 1,
remoteProposalId: 1,
chainId: ChainId.BSC_TESTNET,
state: ProposalCommandState.Executed,
bridgedAt: fakePastDate,
queuedAt: fakePastDate,
succeededAt: fakePastDate,
executedAt: fakePastDate,
actionSignatures: [
state: RemoteProposalState.Executed,
bridgedDate: fakePastDate,
queuedDate: fakePastDate,
executedDate: fakePastDate,
proposalActions: [
{
actionIndex: 0,
target: '0x2Ce1d0ffD7E869D9DF33e28552b12DdDed326706',
Expand All @@ -29,11 +30,13 @@ export const commands: ProposalCommand[] = [
],
},
{
proposalId: 2,
remoteProposalId: 2,
chainId: ChainId.OPBNB_TESTNET,
state: ProposalCommandState.Bridged,
bridgedAt: fakePastDate,
queuedAt: fakePastDate,
actionSignatures: [
state: RemoteProposalState.Bridged,
bridgedDate: fakePastDate,
queuedDate: fakePastDate,
proposalActions: [
{
actionIndex: 0,
target: '0x2Ce1d0ffD7E869D9DF33e28552b12DdDed326706',
Expand All @@ -51,12 +54,14 @@ export const commands: ProposalCommand[] = [
],
},
{
proposalId: 3,
remoteProposalId: 3,
chainId: ChainId.SEPOLIA,
state: ProposalCommandState.Queued,
bridgedAt: fakePastDate,
queuedAt: fakePastDate,
executableAt: fakeFutureDate,
actionSignatures: [
state: RemoteProposalState.Queued,
bridgedDate: fakePastDate,
queuedDate: fakePastDate,
executionEtaDate: fakeFutureDate,
proposalActions: [
{
actionIndex: 0,
target: '0x2Ce1d0ffD7E869D9DF33e28552b12DdDed326706',
Expand All @@ -74,36 +79,14 @@ export const commands: ProposalCommand[] = [
],
},
{
proposalId: 4,
remoteProposalId: 4,
chainId: ChainId.SEPOLIA,
state: ProposalCommandState.Queued,
bridgedAt: fakePastDate,
queuedAt: fakePastDate,
executableAt: fakePastDate,
actionSignatures: [
{
actionIndex: 0,
target: '0x2Ce1d0ffD7E869D9DF33e28552b12DdDed326706',
signature: 'test()',
value: '',
callData: '0x',
},
{
actionIndex: 0,
target: '0x2Ce1d0ffD7E869D9DF33e28552b12DdDed326706',
signature: 'test()',
value: '',
callData: '0x',
},
],
},
{
chainId: ChainId.OPBNB_TESTNET,
state: ProposalCommandState.Queued,
bridgedAt: fakePastDate,
queuedAt: fakePastDate,
executableAt: fakePastDate,
failedExecutionAt: fakeFutureDate,
actionSignatures: [
state: RemoteProposalState.Queued,
bridgedDate: fakePastDate,
queuedDate: fakePastDate,
executionEtaDate: fakePastDate,
proposalActions: [
{
actionIndex: 0,
target: '0x2Ce1d0ffD7E869D9DF33e28552b12DdDed326706',
Expand All @@ -121,13 +104,15 @@ export const commands: ProposalCommand[] = [
],
},
{
proposalId: 6,
remoteProposalId: 6,
chainId: ChainId.ARBITRUM_SEPOLIA,
state: ProposalCommandState.Canceled,
bridgedAt: fakePastDate,
queuedAt: fakePastDate,
executableAt: fakePastDate,
canceledAt: fakePastDate,
actionSignatures: [
state: RemoteProposalState.Canceled,
bridgedDate: fakePastDate,
queuedDate: fakePastDate,
executionEtaDate: fakePastDate,
canceledDate: fakePastDate,
proposalActions: [
{
actionIndex: 0,
target: '0x2Ce1d0ffD7E869D9DF33e28552b12DdDed326706',
Expand All @@ -145,13 +130,15 @@ export const commands: ProposalCommand[] = [
],
},
{
proposalId: 7,
remoteProposalId: 7,
chainId: ChainId.ARBITRUM_SEPOLIA,
state: ProposalCommandState.Executed,
bridgedAt: fakePastDate,
queuedAt: fakePastDate,
executableAt: fakePastDate,
executedAt: fakePastDate,
actionSignatures: [
state: RemoteProposalState.Executed,
bridgedDate: fakePastDate,
queuedDate: fakePastDate,
executionEtaDate: fakePastDate,
executedDate: fakePastDate,
proposalActions: [
{
actionIndex: 0,
target: '0x2Ce1d0ffD7E869D9DF33e28552b12DdDed326706',
Expand Down
Loading

0 comments on commit 7a57307

Please sign in to comment.