Skip to content

Commit

Permalink
fix: update dependencies (#82)
Browse files Browse the repository at this point in the history
* fix: update dependencies

* fix: bump ganache-cli from 6.6.0 to 6.12.2

* fix: rollback openzeppelin from 4.0.0 to 3.4.0

* fix: eslint --fix

* fix: prettier code formatting

* fix: import generated factories from index.ts

* fix: update dependencies

* fix: combine imports and exports
  • Loading branch information
HJunyuan authored Apr 30, 2021
1 parent 65092f8 commit 0b0e2f4
Show file tree
Hide file tree
Showing 24 changed files with 27,700 additions and 16,979 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ version: 2
jobs:
build:
docker:
- image: 'circleci/node:12.13.0'
- image: "circleci/node:12.13.0"
# if need to wait .. => https://support.circleci.com/hc/en-us/articles/360006773953-Race-Conditions-Wait-For-Database
- image: trufflesuite/ganache-cli:v6.6.0
- image: trufflesuite/ganache-cli:v6.12.2
command: [ganache-cli -h 0.0.0.0 -p 8545 -i 1337 -s foobar -e 100000000000000000000]
steps:
- checkout
Expand All @@ -25,4 +25,4 @@ jobs:
command: npm run build
- run:
name: release
command: npm run semantic-release
command: npm run semantic-release
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"no-unused-vars": "off",
"no-restricted-globals": "off",
"import/prefer-default-export": "off",
"import/no-extraneous-dependencies": ["error", {"devDependencies": ["**/*.test.*"]}]
"import/no-extraneous-dependencies": ["error", { "devDependencies": ["**/*.test.*"] }]
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"compiler-version": ["error", "^0.6.10"],
"func-name-mixedcase": "off",
"no-empty-blocks": "off",
"reason-string": ["warn", {"maxLength": 256}]
"reason-string": ["warn", { "maxLength": 256 }]
}
}
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
}
"typescript.tsdk": "node_modules/typescript/lib"
}
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@ To use the package, you will need to provide your own Web3 [provider](https://do
Deploying new document store

```ts
import {deployAndWait} from "@govtechsg/document-store";
import { deployAndWait } from "@govtechsg/document-store";

const documentStore = await deployAndWait("My Document Store", signer).then(console.log);
```

Connecting to existing document store on Ethereum

```ts
import {connect} from "@govtechsg/document-store";
import { connect } from "@govtechsg/document-store";

const documentStore = await connect("0x4077534e82c97be03a07fb10f5c853d2bc7161fb", providerOrSigner);
```

Deploying new document store with minimal proxy (TBD - Not available yet)

```ts
import {deployMinimal} from "@govtechsg/document-store";
import { deployMinimal } from "@govtechsg/document-store";

deployMinimal("My Document Store", signer).then(console.log);
```
Expand Down Expand Up @@ -79,7 +79,7 @@ isRevokedBefore
Different ways to get provider or signer:

```ts
import {Wallet, providers, getDefaultProvider} from "ethers";
import { Wallet, providers, getDefaultProvider } from "ethers";

// Providers
const mainnetProvider = getDefaultProvider();
Expand All @@ -92,7 +92,6 @@ const signerFromEncryptedJson = Wallet.fromEncryptedJson(json, password);
signerFromEncryptedJson.connect(provider);
const signerFromMnemonic = Wallet.fromMnemonic("MNEMONIC-HERE");
signerFromMnemonic.connect(provider);

```

## Setup
Expand Down
34 changes: 17 additions & 17 deletions benchmark/GasCostBenchmark.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const {groupBy, mapValues} = require("lodash");
const { groupBy, mapValues } = require("lodash");

const UpgradableDocumentStore = artifacts.require("./UpgradableDocumentStore.sol");
const DocumentStoreWithRevokeReasons = artifacts.require("./DocumentStoreWithRevokeReasons.sol");
Expand All @@ -7,32 +7,32 @@ const DocumentStoreCreator = artifacts.require("./DocumentStoreCreator.sol");
const BaseAdminUpgradeabilityProxy = artifacts.require("./BaseAdminUpgradeabilityProxy.sol");

UpgradableDocumentStore.numberFormat = "String";
const {generateHashes} = require("../scripts/generateHashes");
const { generateHashes } = require("../scripts/generateHashes");

const initializeAbi = {
constant: false,
inputs: [
{
internalType: "string",
name: "_name",
type: "string"
type: "string",
},
{
internalType: "address",
name: "owner",
type: "address"
}
type: "address",
},
],
name: "initialize",
outputs: [],
payable: false,
stateMutability: "nonpayable",
type: "function"
type: "function",
};

const STORE_NAME = "THE_STORE_NAME";
let lastIssuedHash = "0x3a267813bea8120f55a7b9ca814c34dd89f237502544d7c75dfd709a659f6432";
const randomHashes = num => {
const randomHashes = (num) => {
const generated = generateHashes(num, lastIssuedHash);
lastIssuedHash = generated[generated.length - 1];
return generated;
Expand All @@ -45,7 +45,7 @@ describe("Gas Cost Benchmarks", () => {
gasRecords.push({
contract,
context,
gas
gas,
});
};

Expand Down Expand Up @@ -106,16 +106,16 @@ describe("Gas Cost Benchmarks", () => {
recordGasCost(contractName, "transferOwnership", transferTx.receipt.cumulativeGasUsed);

// Revert the owner by transferring back
await contractInstance.transferOwnership(accounts[0], {from: accounts[2]});
await contractInstance.transferOwnership(accounts[0], { from: accounts[2] });
};

after(() => {
const groupedRecords = groupBy(gasRecords, record => record.context);
const records = mapValues(groupedRecords, contextualizedRecords =>
const groupedRecords = groupBy(gasRecords, (record) => record.context);
const records = mapValues(groupedRecords, (contextualizedRecords) =>
contextualizedRecords.reduce(
(state, current) => ({
...state,
[current.contract]: current.gas
[current.contract]: current.gas,
}),
{}
)
Expand All @@ -136,7 +136,7 @@ describe("Gas Cost Benchmarks", () => {

contract(
"UpgradableDocumentStore",
accounts => {
(accounts) => {
const contractName = "UpgradableDocumentStore";

it("runs benchmark", async () => {
Expand Down Expand Up @@ -178,7 +178,7 @@ describe("Gas Cost Benchmarks", () => {

contract(
"DocumentStore (Minimal Proxy)",
accounts => {
(accounts) => {
const contractName = "DocumentStore (Minimal Proxy)";

it("runs benchmark", async () => {
Expand All @@ -205,7 +205,7 @@ describe("Gas Cost Benchmarks", () => {

contract(
"DocumentStore (AdminUpgradableProxy)",
accounts => {
(accounts) => {
const contractName = "DocumentStore (AdminUpgradableProxy)";

it("runs benchmark", async () => {
Expand All @@ -231,8 +231,8 @@ describe("Gas Cost Benchmarks", () => {

// update
const proxyInstance = await BaseAdminUpgradeabilityProxy.at(adminUpgradableProxyAddress);
const {receipt} = await proxyInstance.upgradeTo(staticDocumentStoreWithRevokeReasons.address, {
from: accounts[1]
const { receipt } = await proxyInstance.upgradeTo(staticDocumentStoreWithRevokeReasons.address, {
from: accounts[1],
});
recordGasCost(contractName, "upgrade", receipt.cumulativeGasUsed);
});
Expand Down
2 changes: 1 addition & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ module.exports = {
extends: ["@commitlint/config-conventional"],

// Add your own rules. See http://marionebl.github.io/commitlint
rules: {}
rules: {},
};
2 changes: 1 addition & 1 deletion config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const INSTITUTE_NAME = "Government Technology Agency of Singapore (GovTech)";

module.exports = {
INSTITUTE_NAME
INSTITUTE_NAME,
};
1 change: 0 additions & 1 deletion contracts/GsnCapableDocumentStore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import "./OwnableDocumentStore.sol";
import "./GsnCapable.sol";

contract GsnCapableDocumentStore is OwnableDocumentStore, BaseRelayRecipient, IKnowForwarderAddress, GsnCapable {

string public override versionRecipient = "2.0.0";

constructor(string memory _name, address _forwarder) public OwnableDocumentStore(_name) {
Expand Down
2 changes: 1 addition & 1 deletion contracts/NaivePaymaster.sol
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ contract NaivePaymaster is BasePaymaster {
emit PostRelayed(abi.decode(context, (uint256)));
}

function versionPaymaster() external virtual override view returns (string memory) {
function versionPaymaster() external view virtual override returns (string memory) {
return version;
}
}
1 change: 0 additions & 1 deletion contracts/OwnableDocumentStore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,4 @@ contract OwnableDocumentStore is BaseDocumentStore, Ownable {
function bulkRevoke(bytes32[] memory documents) public onlyOwner {
return BaseDocumentStore._bulkRevoke(documents);
}

}
2 changes: 1 addition & 1 deletion jest/setup.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// setup.js
import {setupBlockchain} from "./utils";
import { setupBlockchain } from "./utils";

module.exports = async () => {
await setupBlockchain();
Expand Down
2 changes: 1 addition & 1 deletion jest/teardown.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// teardown.js
import {teardownBlockchain} from "./utils";
import { teardownBlockchain } from "./utils";

module.exports = async () => {
await teardownBlockchain();
Expand Down
Loading

0 comments on commit 0b0e2f4

Please sign in to comment.