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

206 replace safe sdk #216

Merged
merged 10 commits into from
Aug 17, 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
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ RPC_URL=http://localhost:8545
API_SERVICE_ENDPOINT=http://api.circles.local
GRAPH_NODE_ENDPOINT=http://graph.circles.local
PATHFINDER_SERVICE_ENDPOINT=http://localhost:8081
RELAY_SERVICE_ENDPOINT=http://relay.circles.local
RELAY_SERVICE_ENDPOINT=http://localhost:3002

# Database Endpoint
DATABASE_SOURCE=graph
Expand All @@ -18,6 +18,8 @@ HUB_ADDRESS=0xCfEB869F69431e42cdB54A4F4f105C19C080A601
PROXY_FACTORY_ADDRESS=0x9b1f7F645351AF3631a656421eD2e40f2802E6c0
SAFE_ADDRESS=0x2612Af3A521c2df9EAF28422Ca335b04AdF3ac66
SAFE_DEFAULT_CALLBACK_HANDLER=0x67B5656d60a809915323Bf2C40A8bEF15A152e3e
MULTI_SEND_ADDRESS=0xe982E462b094850F12AF94d21D470e21bE9D0E9C
MULTI_SEND_CALL_ONLY_ADDRESS=0x0290FB167208Af455bB137780163b7B7a9a10C16

# Smart contract addresses of the Base CRC version
PROXY_FACTORY_ADDRESS_CRC=0xD833215cBcc3f914bD1C9ece3EE7BF8B14f841bb
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
DOCKER_COMPOSE: docker-compose -f docker-compose.yml -f docker-compose.frontend.yml -p circles
DOCKER_COMPOSE: docker-compose -f docker-compose.yml -p circles

steps:
- name: Add hosts to /etc/hosts
Expand Down Expand Up @@ -45,16 +45,16 @@ jobs:

- name: Container setup via docker-compose without pathfinder
working-directory: circles-docker
run: docker compose -f docker-compose.yml -f docker-compose.relayer-pull.yml -f docker-compose.api-pull.yml -p circles up --detach --remove-orphans --build
run: docker compose -f docker-compose.yml -f docker-compose.relayer-pull.yml -f docker-compose.api-pull.yml -f docker-compose.payment-api-pull.yml -p circles up --detach --remove-orphans --build

- name: Download and migrate contracts
working-directory: circles-docker
run: ./scripts/migrate-contracts.sh

- name: Try starting failed services
working-directory: circles-docker
run: docker compose -f docker-compose.yml -f docker-compose.relayer-pull.yml -f docker-compose.api-pull.yml -p circles up --detach --remove-orphans --build
run: docker compose -f docker-compose.yml -f docker-compose.relayer-pull.yml -f docker-compose.api-pull.yml -f docker-compose.payment-api-pull.yml -p circles up --detach --remove-orphans --build

- name: Container setup via docker-compose for pathfinder
working-directory: circles-docker
run: docker compose -f docker-compose.pathfinder-pull.yml -p circles up --detach --build
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
docs
lib
node_modules
coverage
10 changes: 7 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ require('dotenv').config();
if (!('crypto' in globalThis)) globalThis.crypto = require('crypto');

module.exports = {
testEnvironment: 'node',
testTimeout: 360 * 1000,

collectCoverage: true,
globalTeardown: '<rootDir>/teardown.js',
// Resolve modules with alias
moduleNameMapper: {
'^~(.*)$': '<rootDir>/src$1',
},
modulePathIgnorePatterns: ['<rootDir>/test/helpers'],
testEnvironment: 'node',
testMatch: ['**/safe.test.js'],
testTimeout: 360 * 1000,
verbose: true,
};
195 changes: 187 additions & 8 deletions package-lock.json

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

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"docs:serve": "documentation serve --watch ./src/**",
"docs:lint": "documentation lint ./src/**",
"lint": "eslint --ignore-path .gitignore --ignore-pattern lib .",
"test": "jest --runInBand",
"test": "jest --runInBand --forceExit",
"test:watch": "npm run test -- --watch"
},
"devDependencies": {
Expand All @@ -42,6 +42,7 @@
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.1.0",
"@rollup/plugin-terser": "^0.4.3",
"@truffle/hdwallet-provider": "2.1.13",
"babel-plugin-add-module-exports": "^1.0.4",
"babel-plugin-module-resolver": "^5.0.0",
"documentation": "^14.0.2",
Expand All @@ -65,6 +66,8 @@
"@circles/circles-contracts": "^3.3.2",
"@circles/safe-contracts": "=1.0.14",
"@gnosis.pm/safe-contracts": "^1.3.0",
"@safe-global/protocol-kit": "1.2.0",
"@safe-global/safe-core-sdk-types": "2.2.0",
"eth-lib": "^0.2.8"
}
}
13 changes: 13 additions & 0 deletions src/common/createErrorType.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export default function createErrorType(name, code, init) {
function E(message) {
if (!Error.captureStackTrace) this.stack = new Error().stack;
else Error.captureStackTrace(this, this.constructor);
this.message = message;
this.code = code;
init && init.apply(this, arguments);
}
E.prototype = new Error();
E.prototype.name = name;
E.prototype.constructor = E;
return E;
}
7 changes: 7 additions & 0 deletions src/common/error.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import createSymbolObject from '~/common/createSymbolObject';
import createErrorType from '~/common/createErrorType';

export const ErrorCodes = createSymbolObject([
'FAILED_REQUEST',
'INSUFFICIENT_FUNDS',
'INVALID_OPTIONS',
'INVALID_TRANSFER',
'SAFE_NOT_FOUND',
'SAFE_ALREADY_DEPLOYED',
'TOKEN_NOT_FOUND',
'TOO_COMPLEX_TRANSFER',
'TOO_MANY_ATTEMPTS',
Expand Down Expand Up @@ -57,3 +59,8 @@ export class TransferError extends CoreError {
this.transfer = transferData;
}
}

export const SafeDeployedError = createErrorType(
'SafeDeployedError',
ErrorCodes.SAFE_ALREADY_DEPLOYED,
);
Loading
Loading