Skip to content

Commit

Permalink
Merge pull request #1 from gnosis/fix-bytes32
Browse files Browse the repository at this point in the history
Fix paramType for fixed-length bytes parameters
  • Loading branch information
jfschwarz authored Sep 15, 2023
2 parents 5fb7cf3 + 267dfb4 commit e42930f
Show file tree
Hide file tree
Showing 7 changed files with 1,987 additions and 1,244 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const PlaceholderPerType: Record<ParamNativeType, string> = {
[ParamNativeType.ADDRESS]: "0xABF...123",
[ParamNativeType.STRING]: "Enter a string",
[ParamNativeType.BYTES]: "0x...",
[ParamNativeType.BYTES_FIXED]: "0x...",
[ParamNativeType.UNSUPPORTED]: "0x...",
}

Expand Down
1 change: 1 addition & 0 deletions packages/app/src/typings/role.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export enum ParamNativeType {
INT,
BOOLEAN,
BYTES,
BYTES_FIXED,
ADDRESS,
STRING,
ARRAY,
Expand Down
3 changes: 3 additions & 0 deletions packages/app/src/utils/conditions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ export function getNativeType(param: ethers.utils.ParamType | null): ParamNative
if (param.arrayChildren.baseType === "array") return ParamNativeType.UNSUPPORTED
return ParamNativeType.ARRAY
}
if(param.baseType.startsWith('bytes') && param.baseType !== 'bytes') {
return ParamNativeType.BYTES_FIXED
}
return ParamNativeType.BYTES
}

Expand Down
6 changes: 3 additions & 3 deletions packages/sdk/test/karpatkey/replayTransactions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ describe("Karpatkey: Replay Transactions Test", async () => {
network,
}: {
preset: RolePreset
config: typeof KARPATKEY_ADDRESSES["DAO_GNO"]
config: (typeof KARPATKEY_ADDRESSES)["DAO_GNO"]
transactionsJson: {
success: string[]
fail: string[]
Expand All @@ -112,8 +112,8 @@ describe("Karpatkey: Replay Transactions Test", async () => {
const safeService = new SafeServiceClient({
txServiceUrl:
network === 100
? "https://safe-transaction.xdai.gnosis.io"
: "https://safe-transaction.mainnet.gnosis.io/",
? "https://safe-transaction-gnosis-chain.safe.global"
: "https://safe-transaction-mainnet.safe.global",
ethAdapter: ethAdapter as EthAdapter,
})

Expand Down
6 changes: 3 additions & 3 deletions packages/subgraph/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
"prepare:gnosis-chain": "mustache network_configs/gnosis-chain.json subgraph.template.yaml > subgraph.yaml"
},
"dependencies": {
"@graphprotocol/graph-cli": "0.26.0",
"@graphprotocol/graph-ts": "0.24.1"
"@graphprotocol/graph-cli": "^0.56.0",
"@graphprotocol/graph-ts": "^0.31.0"
},
"devDependencies": {
"mustache": "^4.2.0",
"prettier": "^2.5.1"
}
}
}
8 changes: 4 additions & 4 deletions packages/subgraph/src/permissions.mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
ScopeRevokeFunction,
UnscopeParameter,
} from "../generated/Permissions/Permissions"
import { Role, Target, RolesModifier, Function, Parameter } from "../generated/schema"
import { Address, Bytes, log, store } from "@graphprotocol/graph-ts"
import { Target, Parameter } from "../generated/schema"
import { store, TypedMapEntry, Value } from "@graphprotocol/graph-ts"
import {
CLEARANCE,
CLEARANCE__FUNCTION,
Expand Down Expand Up @@ -139,9 +139,9 @@ export function handleScopeFunction(event: ScopeFunction): void {

if (theFunction.parameters != null) {
// remove old parameters if it exists
const parameters: string[] = theFunction.parameters!
const parameters: TypedMapEntry<string, Value>[] = theFunction.parameters.entries
for (let i = 0; i < parameters.length; i++) {
const parameterId = parameters[i]
const parameterId = parameters[i].key
store.remove("Parameter", parameterId)
}
}
Expand Down
Loading

1 comment on commit e42930f

@vercel
Copy link

@vercel vercel bot commented on e42930f Sep 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.