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-545 : fix indexing ERC20Wrapped #426

Merged
merged 3 commits into from
Jul 10, 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
7 changes: 7 additions & 0 deletions packages/subgraph/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [UPCOMING]

### Changed

- Fixed wrong interface for indexing GovernanceWrappedERC20.

## [1.2.0]

### Added

- Added "v" to the version on the github deploy flow.
- Added handler for `NewURI` event on DAO.
- Added `delegatee`, `votingPower` and `delegators` to the `TokenVotingMember`.
- Added support for indexing GovernanceWrappedERC20 and underlying token.

### Changed

Expand Down
2 changes: 2 additions & 0 deletions packages/subgraph/manifest/subgraph.placeholder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ dataSources:
file: $ARAGON_OSX_MODULE/artifacts/src/plugins/governance/majority-voting/token/TokenVoting.sol/TokenVoting.json
- name: AddresslistVoting
file: $ARAGON_OSX_MODULE/artifacts/src/plugins/governance/majority-voting/addresslist/AddresslistVoting.sol/AddresslistVoting.json
- name: GovernanceWrappedERC20
file: $ARAGON_OSX_MODULE/artifacts/src/token/ERC20/governance/GovernanceWrappedERC20.sol/GovernanceWrappedERC20.json
eventHandlers:
- event: InstallationPrepared(indexed address,indexed address,bytes32,indexed address,(uint8,uint16),bytes,address,(address[],(uint8,address,address,address,bytes32)[]))
handler: handleInstallationPrepared
Expand Down
2 changes: 1 addition & 1 deletion packages/subgraph/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aragon/osx-subgraph",
"version": "1.2.0",
"version": "1.2.1",
"description": "The Aragon OSx Subgraph",
"homepage": "https://github.com/aragon/osx",
"license": "AGPL-3.0-or-later",
Expand Down
22 changes: 19 additions & 3 deletions packages/subgraph/src/plugin/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ import {
MULTISIG_INTERFACE
} from '../utils/constants';
import {supportsInterface} from '../utils/erc165';
import {fetchERC20} from '../utils/tokens/erc20';
import {
fetchERC20,
fetchWrappedERC20,
supportsERC20Wrapped
} from '../utils/tokens/erc20';

export const PERMISSION_OPERATIONS = new Map<number, string>()
.set(0, 'Grant')
Expand Down Expand Up @@ -61,8 +65,20 @@ function createTokenVotingPlugin(plugin: Address, daoId: string): void {
packageEntity.minDuration = minDuration.reverted ? null : minDuration.value;

if (!token.reverted) {
let contract = fetchERC20(token.value);
if (contract) {
let tokenAddress = token.value;
if (supportsERC20Wrapped(tokenAddress)) {
let contract = fetchWrappedERC20(tokenAddress);
if (!contract) {
return;
}

packageEntity.token = contract.id;
} else {
let contract = fetchERC20(tokenAddress);
if (!contract) {
return;
}

packageEntity.token = contract.id;
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/subgraph/src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ export const TOKEN_VOTING_INTERFACE = '0x50eb001e';
export const ADDRESSLIST_VOTING_INTERFACE = '0x5f21eb8b';
export const ADMIN_INTERFACE = '0xa5793356';
export const MULTISIG_INTERFACE = '0x8f852786';
export const WRAPPED_ERC20_INTERFACE = '0x12cdd3ac';
export const WRAPPED_ERC20_INTERFACE = '0x0f13099a';
brickpop marked this conversation as resolved.
Show resolved Hide resolved

export const RATIO_BASE = '1000000'; // 10**6