Skip to content

Commit

Permalink
feat: api prototype finished
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrzn committed Jun 30, 2021
1 parent 3140e86 commit 596a702
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 22 deletions.
Binary file added .DS_Store
Binary file not shown.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ artifacts
cache
coverage*
deployments
dist
dist
./DS_Store
Binary file added contracts/.DS_Store
Binary file not shown.
2 changes: 0 additions & 2 deletions contracts/ModuleProxyFactory.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity >=0.8.0;


// @TODO: Cesar's opinion: This is the way we should import external modules
// currently it's not working because there are redundant declarations
// i.e: Enum or Executor - Making the compile script to fail
Expand Down Expand Up @@ -59,6 +58,5 @@ contract ModuleProxyFactory {
}
}
nonce++;
emit ModuleProxyCreation(clone);
}
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
"name": "@gnosis/module-factory",
"version": "1.0.0",
"description": "",
"main": "index.js",
"main": "./dist/index.js",
"typings": "./dist/index.d.ts",
"scripts": {
"build": "tsc",
"compile": "hardhat compile",
"test": "hardhat test",
"coverage": "hardhat coverage",
"deploy": "hardhat deploy",
"deploy": "hardhat deploy --network rinkeby",
"lint": "yarn lint:sol && yarn lint:ts",
"lint:sol": "solhint 'contracts/**/*.sol'",
"lint:ts": "eslint --max-warnings 0",
Expand Down
20 changes: 10 additions & 10 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ export const CONTRACT_ADDRESSES: Record<number, ContractAddresses> = {
factory: "",
},
4: {
dao: "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",
amb: "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0",
delay: "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9",
factory: "0x5FbDB2315678afecb367f032d93F642f64180aa3",
dao: "0x8a5218F72A9F77eA737cc0FE3466f37a42dAF632",
amb: "0x3edd483F59bE021940dc27475e21E74Daf3fE531",
delay: "0x3e4405E7ABeBA5af7e724E9642857963026Fa05E",
factory: "0x184Befc81F0A6983c37d8ae2F5de10AA247409f2",
},
};

export const CONTRACT_ABIS = {
dao: [
`function setUp(
Executor _executor,
Realitio _oracle,
address _executor,
address _oracle,
uint32 timeout,
uint32 cooldown,
uint32 expiration,
Expand All @@ -29,15 +29,15 @@ export const CONTRACT_ABIS = {
],
amb: [
`function setUp(
Executor _executor,
IAMB _amb,
address _executor,
address _amb,
address _owner,
bytes32 _chainId
) external`,
],
delay: [
`function setUp(
Executor _executor,
address _executor,
uint256 cooldown,
uint256 expiration
) external`,
Expand All @@ -47,6 +47,6 @@ export const CONTRACT_ABIS = {
address singleton,
bytes memory initializer
) public returns (address clone)`,
`function nonce() view returns (uint32)`,
],
};

8 changes: 4 additions & 4 deletions src/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ export const deployAndSetUpModule = async (
chainId
);
const moduleSetupData = module.interface.encodeFunctionData("setUp", args);

const expectedModuleAddress = await calculateProxyAddress(factory);

const deployData = factory.interface.encodeFunctionData("deployModule", [
module.address,
moduleSetupData,
]);

const expectedModuleAddress = await calculateProxyAddress(factory);

const transaction = {
data: deployData,
to: factory.address,
value: "0x",
value: "0",
};
return {
transaction,
Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
export {
deployAndSetUpModule,
calculateProxyAddress,
getFactoryAndModule,
} from "./factory";
import { KnownContracts, ContractAddresses, KnownModules } from "./types";
import { CONTRACT_ADDRESSES, CONTRACT_ABIS } from "./constants";
export { KnownContracts, ContractAddresses, KnownModules } from "./types";
export { CONTRACT_ADDRESSES, CONTRACT_ABIS } from "./constants";

0 comments on commit 596a702

Please sign in to comment.