Skip to content

Commit

Permalink
Merge branch 'release/0.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
taha-abbasi committed Nov 21, 2022
2 parents 3509924 + 5cc6ee8 commit 472eedd
Show file tree
Hide file tree
Showing 11 changed files with 94 additions and 32 deletions.
5 changes: 3 additions & 2 deletions contracts/dummy/DummyToken.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma solidity ^0.8.2;
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "../common/IFerrumDeployer.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
Expand All @@ -11,4 +11,5 @@ contract DummyToken is ERC20Burnable {
}
}

contract DummyTokenOwnable is DummyToken, Ownable {}
contract DummyTokenOwnable is DummyToken, Ownable {
}
3 changes: 2 additions & 1 deletion contracts/taxing/GeneralTaxDistributorDiscrete.sol
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ contract GeneralTaxDistributorDiscrete is GeneralTaxDistributor {
amount = remaining;
}
if (amount != 0) {
distributeToTarget(
return distributeToTarget(
i,
ti.tokenSpecificConfig,
token,
Expand All @@ -63,5 +63,6 @@ contract GeneralTaxDistributorDiscrete is GeneralTaxDistributor {
);
}
}
return 0;
}
}
4 changes: 0 additions & 4 deletions hardhat.config.js

This file was deleted.

20 changes: 20 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { HardhatUserConfig } from "hardhat/config";
import '@typechain/hardhat'
import '@nomiclabs/hardhat-ethers'
import '@nomiclabs/hardhat-waffle'


const config: HardhatUserConfig = {
solidity: {
compilers: [{ version: "0.8.2", settings: {
optimizer: {
enabled: true,
runs: 200
}
} }],
},

};

export default config;

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"description": "Commonly used smart contracts from Ferrum Founday",
"author": "Ferrum Network",
"license": "MIT",
"scripts": {
"postinstall": "npx hardhat compile"
},
"dependencies": {
"@openzeppelin/contracts": "^4.1.0",
"@openzeppelin/contracts-upgradeable": "^4.3.2",
Expand All @@ -25,11 +28,10 @@
"@nomiclabs/hardhat-etherscan": "^2.1.3",
"@nomiclabs/hardhat-waffle": "^2.0.1",
"@typechain/ethers-v5": "^7.0.1",
"@typechain/hardhat": "^2.0.2",
"@typechain/hardhat": "^6.1.4",
"@typechain/truffle-v5": "^5.0.0",
"@typechain/web3-v1": "^3.0.0",
"ethereum-waffle": "^3.4.0",
"hardhat-typechain": "^0.3.5",
"ts-generator": "^0.1.1",
"typechain": "^5.0.0"
}
Expand Down
34 changes: 33 additions & 1 deletion test/common/Eip712Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,36 @@ export function multiSigToBytes(sigs: string[]): string {
vs = vs + '0'.repeat(padding);
sig = sig + vs;
return '0x' + sig;
}
}

export async function getBridgeMethodCall(
contractName: string,
contractVersion: string,
chainId: number,
bridge: string,
methodName: string,
args: {type: string, name: string, value: string}[], sks: string[]) {
const web3 = new Web3();
// console.log('We are going to bridge method call it ', args)
const msg = produceSignature(
web3.eth, chainId, bridge, {
contractName: contractName,
contractVersion: contractVersion,
method: methodName,
args,
} as Eip712Params,
);
// console.log('About to producing msg ', msg)
const sigs = [];
for (const sk of sks) {
console.log(` About to sign with private key ${sk}`);
const {sig, addr} = await signWithPrivateKey(sk, msg.hash!);
sigs.push({sig, addr});
}
// Make sure that signatures are in the order of the signer address
sigs.sort((s1, s2) => Buffer.from(s2.addr, 'hex') < Buffer.from(s1.addr, 'hex') ? 1 : -1);
const fullSig = multiSigToBytes(sigs.map(s => s.sig));
console.log(' Full signature is hash: ', msg.hash, 'sig:', fullSig);
msg.signature = fullSig;
return msg;
}
5 changes: 2 additions & 3 deletions test/common/TestMultiSigCheckable.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { expect } from "chai";
import { ethers } from "hardhat";
import { deployWithOwner, expiryInFuture, getCtx, TestContext, throws } from "./Utils";
import { TestMultiSigCheckable } from '../../typechain/TestMultiSigCheckable';
import { randomSalt } from "./Eip712Utils";
import { getBridgeMethodCall } from "../bridge/BridgeUtilsV12";
import { TestMultiSigCheckable } from '../../typechain-types/TestMultiSigCheckable';
import { randomSalt, getBridgeMethodCall } from "./Eip712Utils";

interface MutliSigContext extends TestContext {
multi: TestMultiSigCheckable;
Expand Down
9 changes: 4 additions & 5 deletions test/token/TestDaoMintableErc20.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { ethers } from "hardhat";
import { abi, deployUsingDeployer, deployWithOwner, getCtx, getTransactionLog, Salt, TestContext, throws, Wei, ZeroAddress } from "../common/Utils";
import { DaoMintableErc20 } from '../../typechain/DaoMintableErc20';
import { TokenDao } from '../../typechain/TokenDao';
import { abi, deployWithOwner, getCtx, TestContext, throws, Wei, ZeroAddress } from "../common/Utils";
import { DaoMintableErc20 } from '../../typechain-types/DaoMintableErc20';
import { TokenDao } from '../../typechain-types/TokenDao';
import { randomBytes } from "crypto";
import { getBridgeMethodCall } from "../bridge/BridgeUtilsV12";
import { getBridgeMethodCall } from "../common/Eip712Utils";
import { expect } from "chai";

const GOV_GROUP_ID = 88;
Expand Down
10 changes: 5 additions & 5 deletions test/token/TestTokenDirect.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { ethers } from "hardhat";
import { abi, deployUsingDeployer, getCtx, getTransactionLog, Salt, TestContext, Wei, ZeroAddress } from "../common/Utils";
import { GenericUpgradableTokenMintable } from '../../typechain/GenericUpgradableTokenMintable';
import { GenericUpgradableTokenMintable } from '../../typechain-types/GenericUpgradableTokenMintable';
import { GenericUpgradableTokenMintable__factory } from
"../../typechain/factories/GenericUpgradableTokenMintable__factory";
import { TransparentUpgradeableProxy__factory } from '../../typechain/factories/TransparentUpgradeableProxy__factory';
import { DirectMinimalErc20__factory } from '../../typechain/factories/DirectMinimalErc20__factory';
import { DirectMinimalErc20 } from '../../typechain/DirectMinimalErc20';
"../../typechain-types/factories/GenericUpgradableTokenMintable__factory";
import { TransparentUpgradeableProxy__factory } from '../../typechain-types/factories/TransparentUpgradeableProxy__factory';
import { DirectMinimalErc20__factory } from '../../typechain-types/factories/DirectMinimalErc20__factory';
import { DirectMinimalErc20 } from '../../typechain-types/DirectMinimalErc20';

const f = GenericUpgradableTokenMintable__factory;

Expand Down
17 changes: 17 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"compilerOptions": {
"target": "es2020",
"module": "commonjs",
"esModuleInterop": true,
"outDir": "dist",
"resolveJsonModule": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true
},
"include": [
"./scripts",
"./test"
],
"files": ["./hardhat.config.ts"]
}
13 changes: 4 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1025,10 +1025,10 @@
lodash "^4.17.15"
ts-essentials "^7.0.1"

"@typechain/hardhat@^2.0.2":
version "2.3.1"
resolved "https://registry.yarnpkg.com/@typechain/hardhat/-/hardhat-2.3.1.tgz#1e8a6e3795e115a5d5348526282b5c597fab0b78"
integrity sha512-BQV8OKQi0KAzLXCdsPO0pZBNQQ6ra8A2ucC26uFX/kquRBtJu1yEyWnVSmtr07b5hyRoJRpzUeINLnyqz4/MAw==
"@typechain/hardhat@^6.1.4":
version "6.1.4"
resolved "https://registry.yarnpkg.com/@typechain/hardhat/-/hardhat-6.1.4.tgz#da930bf17bdae5e0996b86d37992c6c58b8a49c8"
integrity sha512-S8k5d1Rjc+plwKpkorlifmh72M7Ki0XNUOVVLtdbcA/vLaEkuqZSJFdddpBgS5QxiJP+6CbRa/yO6EVTE2+fMQ==
dependencies:
fs-extra "^9.1.0"

Expand Down Expand Up @@ -4428,11 +4428,6 @@ har-validator@~5.1.3:
ajv "^6.12.3"
har-schema "^2.0.0"

hardhat-typechain@^0.3.5:
version "0.3.5"
resolved "https://registry.yarnpkg.com/hardhat-typechain/-/hardhat-typechain-0.3.5.tgz#8e50616a9da348b33bd001168c8fda9c66b7b4af"
integrity sha512-w9lm8sxqTJACY+V7vijiH+NkPExnmtiQEjsV9JKD1KgMdVk2q8y+RhvU/c4B7+7b1+HylRUCxpOIvFuB3rE4+w==

hardhat@^2.11.2:
version "2.12.2"
resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.12.2.tgz#6ae985007b20c1f381c6573799d66c1438c4c802"
Expand Down

0 comments on commit 472eedd

Please sign in to comment.