Skip to content

Commit

Permalink
Merge pull request #62 from 1Hive/fix-tuples
Browse files Browse the repository at this point in the history
Allow the use of tuples in method signatures in exec and act commands
  • Loading branch information
sembrestels authored Mar 7, 2023
2 parents 3389838 + 537dfa5 commit c0aba5a
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/real-apples-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@1hive/evmcrispr': patch
---

Fix exec and act commands to allow the use of tuples in the function signatures.
2 changes: 1 addition & 1 deletion packages/evmcrispr-terminal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.3.0",
"private": true,
"dependencies": {
"@1hive/evmcrispr": "0.10.1",
"@1hive/evmcrispr": "0.10.2",
"@chakra-ui/anatomy": "^2.1.0",
"@chakra-ui/icons": "^2.0.14",
"@chakra-ui/merge-utils": "^2.0.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/evmcrispr/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@1hive/evmcrispr",
"version": "0.10.1",
"version": "0.10.2",
"codename": "collective wisdom",
"license": "GPL-3.0",
"description": "A library that encapsulates actions in EVM scripts for DAOs",
Expand Down
4 changes: 3 additions & 1 deletion packages/evmcrispr/src/utils/web3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import { BigNumber, Wallet, utils } from 'ethers';

import type { Address } from '../types';

export const SIGNATURE_REGEX = /\w+\(((\w+(\[\d*\])*)+(,\w+(\[\d*\])*)*)?\)/;
// JS regex do not support balancing groups, so we do not check parentheses are balanced
export const SIGNATURE_REGEX =
/^\w+\(((\(?\w+(\[\d*\])*\)?)+(,\(?\w+(\[\d*\])*\)?)*)?\)$/;

export async function buildNonceForAddress(
address: Address,
Expand Down
6 changes: 3 additions & 3 deletions packages/evmcrispr/test/modules/aragonos/commands/act.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ describe('AragonOS > commands > act <agent> <targetAddress> <methodSignature> [.

it('should return a correct act action', async () => {
const interpreter = createAragonScriptInterpreter([
`act agent:1 agent:2 "deposit(uint256,uint256[][])" 1 [[2,3],[4,5]]`,
`act agent:1 agent:2 "deposit((uint256,int256),uint256[][])" [1,-2] [[2,3],[4,5]]`,
]);

const actActions = await interpreter.interpret();

const fnABI = new utils.Interface([
'function deposit(uint256,uint256[][])',
'function deposit((uint256,int256),uint256[][])',
]);

const expectedActActions = [
Expand All @@ -46,7 +46,7 @@ describe('AragonOS > commands > act <agent> <targetAddress> <methodSignature> [.
{
to: DAO['agent:2'],
data: fnABI.encodeFunctionData('deposit', [
1,
[1, -2],
[
[2, 3],
[4, 5],
Expand Down
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 comment on commit c0aba5a

@vercel
Copy link

@vercel vercel bot commented on c0aba5a Mar 7, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

evmcrispr-evmcrispr-terminal – ./

evmcrispr-evmcrispr-terminal-1hive.vercel.app
evmcrispr.vercel.app
evmcrispr-evmcrispr-terminal-git-master-1hive.vercel.app

Please sign in to comment.