Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OS-459 : Subgraph update to v1.3.0 #393

Merged
merged 5 commits into from
Jun 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions packages/contracts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Added `initializeFork`, `initializeDeploymentFixture` and `initForkAndFixture` utility functions to `test-utils`.
- Added `UpdateInfo`, and `TestingFork` types, and extended `HardhatRuntimeEnvironment`.
- Inherit `ProtocolVersion` and `ERC165` in `DAOFactory`.
- Inherit `ProtocolVersion` in `DAO`.
- Added a `nonReentrant` modifier to the `execute` function in the `DAO` contract.
- Added `allowFailureMap` to `IDAO.Executed` event.

### Changed

- Extended `getContractAddress` functionality to import addresses from osx-versions if a fork has initiated.
- Fixed logic bug in the `TokenVoting` and `AddresslistVoting` implementations that caused the `createProposal` function to emit the unvalidated `_startDate` and `_endDate` input arguments (that both can be zero) in the `ProposalCreated` event instead of the validated ones.
- Changed the `createProposal` functions in `Multisig` to allow creating proposals when the `_msgSender()` is listed in the current block.
- Changed the `createProposal` functions in `AddresslistVoting` to allow creating proposals when the `_msgSender()` is listed in the current block.
Expand Down
2 changes: 2 additions & 0 deletions packages/subgraph/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Renamed handling updates from v1.2.0 to v1.3.0
- Fixed start & end date issue by indexing from `getProposal()` instead of the event.
- BREAKING: DAO's plugins attribute derive from `PluginInstallation` instead of `IPlugin`.
- BREAKING: Changed attribute of `proposalId` in all proposal entities to `pluginProposalId`
- Supports now multiple `DAORegistries`, `PluginRepoRegistries` and `PluginSetupProcessors` as datasources.
Expand Down
4 changes: 2 additions & 2 deletions packages/subgraph/manifest/subgraph.placeholder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ templates:
handler: handleSignatureValidatorSet
- event: NewURI(string)
handler: handleNewURI
- name: DaoTemplateV1_2_0
- name: DaoTemplateV1_3_0
kind: ethereum/contract
network: {{network}}
source:
Expand All @@ -151,7 +151,7 @@ templates:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/dao/dao_v1_2_0.ts
file: ./src/dao/dao_v1_3_0.ts
entities:
- Dao
abis:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {TransactionActionsProposal} from '../../generated/schema';
import {
Executed,
ExecutedActionsStruct
} from '../../generated/templates/DaoTemplateV1_2_0/DAO';
} from '../../generated/templates/DaoTemplateV1_3_0/DAO';
import {handleAction} from './utils';

export function handleExecuted(event: Executed): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ export function _handleProposalCreated(
proposalEntity.metadata = metadata;
proposalEntity.createdAt = event.block.timestamp;
proposalEntity.creationBlockNumber = event.block.number;
proposalEntity.startDate = event.params.startDate;
proposalEntity.endDate = event.params.endDate;
proposalEntity.allowFailureMap = event.params.allowFailureMap;
proposalEntity.potentiallyExecutable = false;

Expand All @@ -63,6 +61,11 @@ export function _handleProposalCreated(
proposalEntity.snapshotBlock = parameters.snapshotBlock;
proposalEntity.minVotingPower = parameters.minVotingPower;

// Get the dates from `parameters` returned from `getProposal()`,
// so all the dates are correct in both build 1 & 2
proposalEntity.startDate = parameters.startDate;
proposalEntity.endDate = parameters.endDate;

heueristik marked this conversation as resolved.
Show resolved Hide resolved
// Tally
let tally = proposal.value.value3;
proposalEntity.abstain = tally.abstain;
Expand Down
12 changes: 8 additions & 4 deletions packages/subgraph/src/packages/token/token-voting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,18 @@ export function _handleProposalCreated(
daoId: string,
metadata: string
): void {
let pluginAddress = event.address;
let pluginProposalId = event.params.proposalId;
let proposalId = getProposalId(event.address, pluginProposalId);
let proposalId = getProposalId(pluginAddress, pluginProposalId);

let proposalEntity = new TokenVotingProposal(proposalId);
proposalEntity.dao = daoId;
proposalEntity.plugin = event.address.toHexString();
proposalEntity.plugin = pluginAddress.toHexString();
proposalEntity.pluginProposalId = pluginProposalId;
proposalEntity.creator = event.params.creator;
proposalEntity.metadata = metadata;
proposalEntity.createdAt = event.block.timestamp;
proposalEntity.creationBlockNumber = event.block.number;
proposalEntity.startDate = event.params.startDate;
proposalEntity.endDate = event.params.endDate;
proposalEntity.allowFailureMap = event.params.allowFailureMap;
proposalEntity.potentiallyExecutable = false;

Expand All @@ -70,6 +69,11 @@ export function _handleProposalCreated(
proposalEntity.snapshotBlock = parameters.snapshotBlock;
proposalEntity.minVotingPower = parameters.minVotingPower;

// Get the dates from `parameters` returned from `getProposal()`,
// so all the dates are correct in both build 1 & 2
proposalEntity.startDate = parameters.startDate;
proposalEntity.endDate = parameters.endDate;

// Tally
let tally = proposal.value.value3;
proposalEntity.abstain = tally.abstain;
Expand Down
4 changes: 2 additions & 2 deletions packages/subgraph/src/registries/daoRegistry.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {DAORegistered} from '../../generated/DAORegistry/DAORegistry';
import {DaoTemplateV1_0_0, DaoTemplateV1_2_0} from '../../generated/templates';
import {DaoTemplateV1_0_0, DaoTemplateV1_3_0} from '../../generated/templates';
import {Dao} from '../../generated/schema';
import {dataSource} from '@graphprotocol/graph-ts';

Expand All @@ -22,7 +22,7 @@ export function handleDAORegistered(event: DAORegistered): void {

// subscribe to templates
DaoTemplateV1_0_0.create(event.params.dao);
DaoTemplateV1_2_0.create(event.params.dao);
DaoTemplateV1_3_0.create(event.params.dao);

entity.save();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import {
Action,
ERC721Balance
} from '../../generated/schema';
import {Executed} from '../../generated/templates/DaoTemplateV1_2_0/DAO';
import {handleExecuted} from '../../src/dao/dao_v1_2_0';
import {Executed} from '../../generated/templates/DaoTemplateV1_3_0/DAO';
import {handleExecuted} from '../../src/dao/dao_v1_3_0';
import {
ERC20_transfer,
getTransferId,
Expand Down