Skip to content

Commit d2039f7

Browse files
authored
Merge pull request #14 from valory-xyz/mohan/registry-test-cases
feat: test cases for registry
2 parents 704a273 + e87f009 commit d2039f7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+27184
-48794
lines changed

.eslintrc.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"root": true,
3-
"ignorePatterns": ["**/*"],
43
"plugins": ["@nx"],
54
"env": {
65
"browser": true,
@@ -24,7 +23,8 @@
2423
}
2524
]
2625
}
27-
]
26+
],
27+
"react-hooks/exhaustive-deps": "warn"
2828
}
2929
},
3030
{
+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Autonolas registry
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths:
7+
- 'apps/autonolas-registry/**'
8+
pull_request:
9+
paths:
10+
- 'apps/autonolas-registry/**'
11+
12+
jobs:
13+
build:
14+
continue-on-error: False
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
- uses: actions/setup-node@v3
21+
with:
22+
node-version: 18
23+
- name: Install modules
24+
run: yarn
25+
- run: git branch --track main origin/main
26+
- name: Run ESLint
27+
run: yarn nx lint autonolas-registry
28+
- name: Run Test
29+
run: yarn nx test autonolas-registry
30+
scan:
31+
name: gitleaks
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v3
35+
with:
36+
fetch-depth: 0
37+
- uses: actions/setup-go@v3
38+
with:
39+
go-version: '1.17.7'
40+
- run: |
41+
wget https://github.com/zricethezav/gitleaks/releases/download/v8.10.1/gitleaks_8.10.1_linux_x64.tar.gz && \
42+
tar -xzf gitleaks_8.10.1_linux_x64.tar.gz && \
43+
sudo install gitleaks /usr/bin && \
44+
gitleaks detect -r apps/autonolas-registry/gitleaks-report.json -s apps/autonolas-registry -v

.github/workflows/main.yml

-40
This file was deleted.

.github/workflows/tokenomics.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# TODO: figure out how to trigger workflow from vercel for nx
2+
3+
name: Tokenomics
4+
on:
5+
push:
6+
branches:
7+
- main
8+
paths:
9+
- 'apps/tokenomics/**'
10+
pull_request:
11+
paths:
12+
- 'apps/tokenomics/**'
13+
14+
jobs:
15+
build:
16+
continue-on-error: False
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
- uses: actions/setup-node@v3
23+
with:
24+
node-version: 18
25+
- name: Install modules
26+
run: yarn
27+
- run: git branch --track main origin/main
28+
- name: Run ESLint
29+
run: yarn nx lint tokenomics
30+
- name: Run Test
31+
run: yarn nx test tokenomics
32+
scan:
33+
name: gitleaks
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v3
37+
with:
38+
fetch-depth: 0
39+
- uses: actions/setup-go@v3
40+
with:
41+
go-version: '1.17.7'
42+
- run: |
43+
wget https://github.com/zricethezav/gitleaks/releases/download/v8.10.1/gitleaks_8.10.1_linux_x64.tar.gz && \
44+
tar -xzf gitleaks_8.10.1_linux_x64.tar.gz && \
45+
sudo install gitleaks /usr/bin && \
46+
gitleaks detect -r apps/tokenomics/gitleaks-report.json -s apps/tokenomics -v

apps/autonolas-registry/.gitleaksignore

+232-115
Large diffs are not rendered by default.

apps/autonolas-registry/common-util/Contracts/addresses.jsx apps/autonolas-registry/common-util/Contracts/addresses.tsx

+39-29
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,28 @@
1+
import { Address } from 'viem';
12
import {
23
LOCAL_FORK_ID,
34
LOCAL_FORK_ID_GNOSIS,
45
LOCAL_FORK_ID_POLYGON,
5-
} from 'util/constants';
6+
} from '../../util/constants';
67

7-
const MAINNET_ADDRESSES = {
8+
type Addresses = {
9+
serviceManagerToken: Address;
10+
serviceRegistryL2: Address;
11+
serviceRegistryTokenUtility: Address;
12+
operatorWhitelist: Address;
13+
};
14+
15+
type L1Addresses = {
16+
agentRegistry: Address;
17+
componentRegistry: Address;
18+
registriesManager: Address;
19+
serviceManagerToken: Address;
20+
serviceRegistry: Address;
21+
serviceRegistryTokenUtility: Address;
22+
operatorWhitelist: Address;
23+
};
24+
25+
const MAINNET_ADDRESSES: L1Addresses = {
826
agentRegistry: '0x2F1f7D38e4772884b88f3eCd8B6b9faCdC319112',
927
componentRegistry: '0x15bd56669F57192a97dF41A2aa8f4403e9491776',
1028
registriesManager: '0x9eC9156dEF5C613B2a7D4c46C383F9B58DfcD6fE',
@@ -14,14 +32,14 @@ const MAINNET_ADDRESSES = {
1432
operatorWhitelist: '0x42042799B0DE38AdD2a70dc996f69f98E1a85260',
1533
};
1634

17-
const GNOSIS_ADDRESSES = {
35+
const GNOSIS_ADDRESSES: Addresses = {
1836
serviceManagerToken: '0x04b0007b2aFb398015B76e5f22993a1fddF83644',
1937
serviceRegistryL2: '0x9338b5153AE39BB89f50468E608eD9d764B755fD',
2038
serviceRegistryTokenUtility: '0xa45E64d13A30a51b91ae0eb182e88a40e9b18eD8',
2139
operatorWhitelist: '0x526E064cB694E8f5B7DB299158e17F33055B3943',
2240
};
2341

24-
const POLYGON_ADDRESSES = {
42+
const POLYGON_ADDRESSES: Addresses = {
2543
serviceManagerToken: '0x04b0007b2aFb398015B76e5f22993a1fddF83644',
2644
serviceRegistryL2: '0xE3607b00E75f6405248323A9417ff6b39B244b50',
2745
serviceRegistryTokenUtility: '0xa45E64d13A30a51b91ae0eb182e88a40e9b18eD8',
@@ -35,7 +53,7 @@ const POLYGON_ADDRESSES = {
3553
* - optimistic
3654
* - celo
3755
*/
38-
const COMMON_TEST_ADDRESSES = {
56+
const COMMON_TEST_ADDRESSES: Addresses = {
3957
serviceManagerToken: '0x5BA58970c2Ae16Cf6218783018100aF2dCcFc915',
4058
serviceRegistryL2: '0x31D3202d8744B16A120117A053459DDFAE93c855',
4159
serviceRegistryTokenUtility: '0xeB49bE5DF00F74bd240DE4535DDe6Bc89CEfb994',
@@ -110,38 +128,31 @@ export const ADDRESSES = {
110128
11155420: COMMON_TEST_ADDRESSES,
111129
// celo alfajores - testnet for celo
112130
44787: COMMON_TEST_ADDRESSES,
113-
// local
114-
31337: {
115-
agentRegistry: '0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512',
116-
componentRegistry: '0x5FbDB2315678afecb367f032d93F642f64180aa3',
117-
registriesManager: '0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0',
118-
serviceRegistry: '0x998abeb3E57409262aE5b751f60747921B33613E',
119-
serviceManager: '0x4c5859f0F772848b2D91F1D83E2Fe57935348029',
120-
serviceRegistryTokenUtility: '0x36C02dA8a0983159322a80FFE9F24b1acfF8B570',
121-
operatorWhitelist: '0x809d550fca64d94Bd9F66E60752A544199cfAC3D',
122-
// used for testing - service creation/update token address
123-
ERC20Token: '0x1291Be112d480055DaFd8a610b7d1e203891C274',
124-
},
125131
[LOCAL_FORK_ID]: MAINNET_ADDRESSES,
126132
[LOCAL_FORK_ID_GNOSIS]: GNOSIS_ADDRESSES,
127133
[LOCAL_FORK_ID_POLYGON]: POLYGON_ADDRESSES,
128-
};
134+
} as const;
129135

136+
export type ChainIds = keyof typeof ADDRESSES;
137+
138+
type MultisigAddress = {
139+
[chainId in ChainIds]: Address[];
140+
};
130141
// TODO: add testcases for all networks
131142
/**
132143
* check addresses here - GnosisSafeMultisig
133144
* Addresses: https://github.com/valory-xyz/autonolas-registries/blob/main/docs/configuration.json
134145
*/
135-
export const multisigAddresses = {
146+
export const multisigAddresses: MultisigAddress = {
136147
1: ['0x46C0D07F55d4F9B5Eed2Fc9680B5953e5fd7b461'],
137148
5: ['0x65dD51b02049ad1B6FF7fa9Ea3322E1D2CAb1176'],
149+
10: ['0xE43d4F4103b623B61E095E8bEA34e1bc8979e168'],
138150
100: ['0x3C1fF68f5aa342D296d4DEe4Bb1cACCA912D95fE'],
139151
137: ['0x3d77596beb0f130a4415df3D2D8232B3d3D31e44'],
140152
8453: ['0xBb7e1D6Cb6F243D6bdE81CE92a9f2aFF7Fbe7eac'],
141153
10200: ['0xeB49bE5DF00F74bd240DE4535DDe6Bc89CEfb994'],
142154
80001: ['0x9dEc6B62c197268242A768dc3b153AE7a2701396'],
143155
84532: ['0x19936159B528C66750992C3cBcEd2e71cF4E4824'],
144-
31337: ['0x0E801D84Fa97b50751Dbf25036d067dCf18858bF'],
145156
42161: ['0x63e66d7ad413C01A7b49C7FF4e3Bb765C4E4bd1b'],
146157
42220: ['0x63e66d7ad413C01A7b49C7FF4e3Bb765C4E4bd1b'],
147158
421614: ['0x19936159B528C66750992C3cBcEd2e71cF4E4824'],
@@ -152,21 +163,20 @@ export const multisigAddresses = {
152163
[LOCAL_FORK_ID_POLYGON]: ['0x3d77596beb0f130a4415df3D2D8232B3d3D31e44'],
153164
};
154165

155-
// TODO: add testcases for all networks
156166
/**
157167
* check addresses here - GnosisSafeSameAddressMultisig
158168
* Addresses: https://github.com/valory-xyz/autonolas-registries/blob/main/docs/configuration.json
159169
*/
160-
export const multisigSameAddresses = {
170+
export const multisigSameAddresses: MultisigAddress = {
161171
1: ['0xfa517d01DaA100cB1932FA4345F68874f7E7eF46'],
162172
5: ['0x06467Cb835da623384a22aa902647784C1c9f5Ae'],
173+
10: ['0xb09CcF0Dbf0C178806Aaee28956c74bd66d21f73'],
163174
100: ['0x6e7f594f680f7aBad18b7a63de50F0FeE47dfD06'],
164175
137: ['0xd8BCC126ff31d2582018715d5291A508530587b0'],
165176
10200: ['0xE16adc7777B7C2a0d35033bd3504C028AB28EE8b'],
166177
8453: ['0xFbBEc0C8b13B38a9aC0499694A69a10204c5E2aB'],
167178
80001: ['0xd6AA4Ec948d84f6Db8EEf25104CeE0Ecd280C74e'],
168179
84532: ['0x10100e74b7F706222F8A7C0be9FC7Ae1717Ad8B2'],
169-
31337: ['0x8f86403A4DE0BB5791fa46B8e795C547942fE4Cf'],
170180
42161: ['0xBb7e1D6Cb6F243D6bdE81CE92a9f2aFF7Fbe7eac'],
171181
42220: ['0xBb7e1D6Cb6F243D6bdE81CE92a9f2aFF7Fbe7eac'],
172182
421614: ['0x10100e74b7F706222F8A7C0be9FC7Ae1717Ad8B2'],
@@ -177,21 +187,20 @@ export const multisigSameAddresses = {
177187
[LOCAL_FORK_ID_POLYGON]: ['0xd8BCC126ff31d2582018715d5291A508530587b0'],
178188
};
179189

180-
// TODO: add testcases for all networks
181190
/**
182191
* check addresses here - MultiSendCallOnly
183192
* https://github.com/safe-global/safe-deployments/blob/main/src/assets/v1.3.0/multi_send_call_only.json
184193
*/
185-
export const safeMultiSend = {
194+
export const safeMultiSend: MultisigAddress = {
186195
1: ['0x40A2aCCbd92BCA938b02010E17A5b8929b49130D'],
187196
5: ['0x40A2aCCbd92BCA938b02010E17A5b8929b49130D'],
197+
10: ['0xA1dabEF33b3B82c7814B6D82A79e50F4AC44102B'],
188198
100: ['0x40A2aCCbd92BCA938b02010E17A5b8929b49130D'],
189199
137: ['0x40A2aCCbd92BCA938b02010E17A5b8929b49130D'],
190200
8453: ['0xA1dabEF33b3B82c7814B6D82A79e50F4AC44102B'],
191201
10200: ['0x40A2aCCbd92BCA938b02010E17A5b8929b49130D'],
192202
80001: ['0x40A2aCCbd92BCA938b02010E17A5b8929b49130D'],
193203
84532: ['0xA1dabEF33b3B82c7814B6D82A79e50F4AC44102B'],
194-
31337: ['0x9d4454B023096f34B160D6B654540c56A1F81688'],
195204
42161: ['0x40A2aCCbd92BCA938b02010E17A5b8929b49130D'],
196205
42220: ['0xA1dabEF33b3B82c7814B6D82A79e50F4AC44102B'],
197206
421614: ['0x40A2aCCbd92BCA938b02010E17A5b8929b49130D'],
@@ -202,21 +211,22 @@ export const safeMultiSend = {
202211
[LOCAL_FORK_ID_POLYGON]: ['0x40A2aCCbd92BCA938b02010E17A5b8929b49130D'],
203212
};
204213

205-
// TODO: add testcases for all networks
206214
/**
207215
* check addresses here
208216
* https://github.com/safe-global/safe-deployments/blob/main/src/assets/v1.3.0/compatibility_fallback_handler.json
209217
*/
210-
export const FALLBACK_HANDLER = {
218+
export const FALLBACK_HANDLER: {
219+
[chainId in ChainIds]: Address;
220+
} = {
211221
1: '0xf48f2B2d2a534e402487b3ee7C18c33Aec0Fe5e4',
212222
5: '0xf48f2B2d2a534e402487b3ee7C18c33Aec0Fe5e4',
223+
10: '0x017062a1dE2FE6b99BE3d9d37841FeD19F573804',
213224
100: '0xf48f2B2d2a534e402487b3ee7C18c33Aec0Fe5e4',
214225
137: '0xf48f2B2d2a534e402487b3ee7C18c33Aec0Fe5e4',
215226
8453: '0x017062a1dE2FE6b99BE3d9d37841FeD19F573804',
216227
10200: '0xf48f2B2d2a534e402487b3ee7C18c33Aec0Fe5e4',
217228
80001: '0xf48f2B2d2a534e402487b3ee7C18c33Aec0Fe5e4',
218229
84532: '0x017062a1dE2FE6b99BE3d9d37841FeD19F573804',
219-
31337: '0x0000000000000000000000000000000000000000',
220230
42161: '0xf48f2B2d2a534e402487b3ee7C18c33Aec0Fe5e4',
221231
42220: '0x017062a1dE2FE6b99BE3d9d37841FeD19F573804',
222232
421614: '0xf48f2B2d2a534e402487b3ee7C18c33Aec0Fe5e4',

apps/autonolas-registry/common-util/Details/index.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { Header, DetailsTitle } from './styles';
1818

1919
const { Text } = Typography;
2020

21-
const Details = ({
21+
export const Details = ({
2222
id,
2323
type,
2424
getDetails,

0 commit comments

Comments
 (0)