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

Modify findTransitiveTransfer to call the pathfinder service #165

Merged
merged 46 commits into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
1a085d1
Modify findTransitiveTransfer to call the pathfinder service
llunaCreixent Feb 15, 2023
0e7967c
enable to use both pathfinders
JacqueGM Feb 16, 2023
a0e72fb
add variable for pathfinder type
JacqueGM Feb 16, 2023
5ce770c
update token to return steps regardless of which pathfinder it uses
JacqueGM Feb 17, 2023
a5392bc
add pathfinderType
JacqueGM Feb 17, 2023
61010b6
Fix typo
llunaCreixent Feb 20, 2023
ba4109f
Update README.md
llunaCreixent Feb 20, 2023
8bc589e
include call to different pathfinder
JacqueGM Feb 23, 2023
5d1058b
update .env.example
JacqueGM Feb 23, 2023
12fd89d
add pathfinder docker compose
JacqueGM Feb 23, 2023
972660a
force build
JacqueGM Feb 27, 2023
85e94f5
update test workflows
JacqueGM Feb 27, 2023
22bc969
update test workflows
JacqueGM Feb 27, 2023
f808ab7
use docker compose v2
JacqueGM Feb 27, 2023
cf8f074
force build
JacqueGM Feb 27, 2023
8ae2be7
removing temporally the cache
JacqueGM Feb 27, 2023
110d08b
undo remove cache
JacqueGM Feb 27, 2023
a731a24
update test to include update .env
JacqueGM Feb 27, 2023
f401508
force recreate docker after env file updated
JacqueGM Feb 27, 2023
1be74da
force recreate
JacqueGM Feb 28, 2023
6767504
update workflow
JacqueGM Mar 1, 2023
7a39011
update workflow status
JacqueGM Mar 1, 2023
8c81da9
update workflow status
JacqueGM Mar 1, 2023
9c2d7b4
update token test with server flag
JacqueGM Mar 1, 2023
29bd41c
update workflow
JacqueGM Mar 1, 2023
6b7fde1
Update .env.example
llunaCreixent Mar 2, 2023
b655109
update env file
JacqueGM Mar 2, 2023
2dc9215
update env file
JacqueGM Mar 2, 2023
c80b287
update token method
JacqueGM Mar 8, 2023
c8eeefc
force build
JacqueGM Mar 8, 2023
3ad411a
update token and test
JacqueGM Mar 9, 2023
5768fea
update test and token code
JacqueGM Mar 9, 2023
0d5daeb
remove console statements
JacqueGM Mar 9, 2023
6f178f7
run token test
JacqueGM Mar 10, 2023
5cdaf7f
remove console.log
JacqueGM Mar 10, 2023
e7555a0
Add loop for token deployment in token tests
llunaCreixent Mar 16, 2023
66f8039
Deploy test network only once in token tests
llunaCreixent Mar 16, 2023
375d66a
Set max transfer steps value to 30
juanenrisley Mar 16, 2023
51ec5dc
Make lint happy
llunaCreixent Mar 16, 2023
d3ca971
Parameterize core pathfinder type for testing
juanenrisley Mar 16, 2023
410c769
Add loops for Safe tests
llunaCreixent Mar 20, 2023
9b406f0
Add loops for Organization tests
llunaCreixent Mar 20, 2023
cc9f3f4
Make lint happy
llunaCreixent Mar 20, 2023
daad4a8
Remove unused code from test workflow
llunaCreixent Mar 20, 2023
bbba905
Add checking loop in updateToLastVersion method
llunaCreixent Mar 20, 2023
0208539
Use main branch of dockers for tests
llunaCreixent Mar 20, 2023
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
6 changes: 5 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ RPC_URL=http://localhost:8545
# Service Endpoints
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

# Database Endpoints
# Database Endpoint
DATABASE_SOURCE=graph

# Pathfinder Type cli or server
PATHFINDER_TYPE=server

# Smart Contract addresses of 1.3.0 version
HUB_ADDRESS=0xCfEB869F69431e42cdB54A4F4f105C19C080A601
PROXY_FACTORY_ADDRESS=0x9b1f7F645351AF3631a656421eD2e40f2802E6c0
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ jobs:
working-directory: circles-docker
run: cp .env.example .env

- name: Container setup via docker-compose
- 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 -p circles up --detach --remove-orphans --build

- name: Download and migrate contracts
working-directory: circles-docker
Expand All @@ -70,7 +70,11 @@ jobs:

- 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 -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

- name: Install dependencies
working-directory: circles-core
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ const core = new CirclesCore(web3, {
proxyFactoryAddress: '0x9b1f7F645351AF3631a656421eD2e40f2802E6c0',
safeMasterAddress: '0x59d3631c86BbE35EF041872d502F218A39FBa150',
apiServiceEndpoint: 'http://api.circles.local',
pathfinderServiceEndpoint: 'http://pathfinder.circles.local'
pathfinderType: 'server',
graphNodeEndpoint: 'http://graph.circles.local',
databaseSource: 'graph',
relayServiceEndpoint: 'http://relay.circles.local',
Expand Down
16 changes: 15 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export default class CirclesCore {
* @param {Web3} web3 - instance of Web3
* @param {Object} options - global core options
* @param {string} options.apiServiceEndpoint - URL of the username resolver service
* @param {string} options.pathfinderServiceEndpoint - URL of the pathfinder service
* @param {string} options.pathfinderType - Type of pathfinder used to get transfer steps ("cli" or "server")
* @param {string} options.databaseSource - database source type
* @param {string} options.fallbackHandlerAddress - address of the fallback handler of the Safe contract
* @param {string} options.graphNodeEndpoint - URL of the graph node
Expand Down Expand Up @@ -67,12 +69,19 @@ export default class CirclesCore {
apiServiceEndpoint: {
type: 'string',
},
pathfinderServiceEndpoint: {
type: 'string',
},
relayServiceEndpoint: {
type: 'string',
},
subgraphName: {
type: 'string',
},
pathfinderType: {
type: 'string',
default: 'server',
},
});

// Expose error classes and constants
Expand Down Expand Up @@ -110,7 +119,12 @@ export default class CirclesCore {
this.options,
);
/** @type {Object} - token module */
this.token = createTokenModule(web3, this.contracts, this.utils);
this.token = createTokenModule(
web3,
this.contracts,
this.utils,
this.options,
);
/** @type {Object} - trust module */
this.trust = createTrustModule(web3, this.contracts, this.utils);
/** @type {Object} - user module */
Expand Down
12 changes: 12 additions & 0 deletions src/safe.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
getSafeContract,
getSafeCRCVersionContract,
} from '~/common/getContracts';
import loop from '~/common/loop';

/**
* Helper method to receive a list of all Gnosis Safe owners.
Expand Down Expand Up @@ -546,6 +547,17 @@ export default function createSafeModule(
`Safe with version ${safeVersion} failed to change the Master Copy`,
);
}

// Wait to check that the version is updated
await loop(
() => {
return getVersion(web3, options.safeAddress);
},
(version) => {
return version == SAFE_LAST_VERSION;
},
);

// Then we setup the fallbackHandler
const fallbackHandlerTxData = safeInstance.methods
.setFallbackHandler(fallbackHandlerAddress)
Expand Down
Loading