ok. @ylv-io @Dennison I spent another 8h on this and I think I am in the last step but I really have no clue anymore what’s wrong. It’s hanging on the last line of code:
require('dotenv').config({ path: `${__dirname}/.env` });
const chai = require('chai');
chai.use(require('chai-as-promised'));
const assert = chai.assert;
const { fundRecipient } = require('@openzeppelin/gsn-helpers');
const { fromConnection, useEphemeralKey } = require('@openzeppelin/network');
const { utils } = require('@openzeppelin/gsn-provider');
const { isRelayHubDeployedForRecipient, getRecipientFunds } = utils;
const ACLFactory = artifacts.require("AclFactory");
contract('AclFactory', (accounts) => {
const ROOT_ACCOUNT = process.env.NETWORK === 'ganache' ? accounts[0] : process.env.ACCOUNT;
let factory;
it('should deploy a factory', async () => {
factory = await ACLFactory.new();
});
it('should be able to initialize the GSN for the factory', async () => {
let tx = await factory.initialize();
});
it('should fund the recipient (ACLFactory)', async () => {
const factoryAddr = await factory.address;
const tx = await fundRecipient(web3, {
recipient: factoryAddr,
relayHubAddress: "0x511BEd1C29BC163C96B7d4ddE28c7E0590Aa44F5",
amount: web3.utils.toWei("1", "ether"),
from: accounts[0]
});
});
it('should deploy an ACL from user without any funds for FREE', async () => {
const emptyAcc = await web3.eth.accounts.create("secret");
console.log(emptyAcc);
const isDeployed = await isRelayHubDeployedForRecipient(web3, factory.address);
console.log(isDeployed);
const recFunds = await getRecipientFunds(web3, factory.address);
console.log(recFunds);
const localCtx = await fromConnection(
'http://127.0.0.1:8645', {
gsn: { dev: false, signKey: emptyAcc.privateKey }
});
web3 = localCtx.lib;
const factoryAbi = [
{
"constant": true,
"inputs": [],
"name": "getHubAddr",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "context",
"type": "bytes"
}
],
"name": "preRelayedCall",
"outputs": [
{
"name": "",
"type": "bytes32"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "relayHubVersion",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "context",
"type": "bytes"
},
{
"name": "success",
"type": "bool"
},
{
"name": "actualCharge",
"type": "uint256"
},
{
"name": "preRetVal",
"type": "bytes32"
}
],
"name": "postRelayedCall",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "oldRelayHub",
"type": "address"
},
{
"indexed": true,
"name": "newRelayHub",
"type": "address"
}
],
"name": "RelayHubChanged",
"type": "event"
},
{
"constant": false,
"inputs": [
{
"name": "_owner",
"type": "address"
}
],
"name": "newACL",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [],
"name": "initialize",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "",
"type": "address"
},
{
"name": "",
"type": "address"
},
{
"name": "",
"type": "bytes"
},
{
"name": "",
"type": "uint256"
},
{
"name": "",
"type": "uint256"
},
{
"name": "",
"type": "uint256"
},
{
"name": "",
"type": "uint256"
},
{
"name": "",
"type": "bytes"
},
{
"name": "",
"type": "uint256"
}
],
"name": "acceptRelayedCall",
"outputs": [
{
"name": "",
"type": "uint256"
},
{
"name": "",
"type": "bytes"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [],
"name": "setRelayHubAddress",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "getRecipientBalance",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "version",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "pure",
"type": "function"
}
];
const factoryContract = new localCtx.lib.eth.Contract(factoryAbi, factory.address);
let res = await factoryContract.methods.newACL(emptyAcc.address).send({from: emptyAcc.address});
console.log(res);
});
});
Output:
{ address: '0x4C0187138B6c110916458F50D2708f488E549Dcf',
privateKey:
'0x8b958ecb84926eb919162dac17548d77aed657ee94efc51251c4a02caf8a8494',
signTransaction: [Function: signTransaction],
sign: [Function: sign],
encrypt: [Function: encrypt] }
Error: Timeout of 300000ms exceeded.
I am close to jumping from balcony, fortunately I live in first floor…
Any idea?