Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
MickdeGraaf committed Aug 6, 2020
1 parent 2cacc14 commit bc0b27a
Show file tree
Hide file tree
Showing 8 changed files with 2,988 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,9 @@ dist

# TernJS port file
.tern-port

#solidity

cache/
artifacts/

17 changes: 17 additions & 0 deletions buidler.compile.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { BuidlerConfig } from "@nomiclabs/buidler/config";

interface ExtendedBuidlerConfig extends BuidlerConfig {
[x:string]: any
}

const config: ExtendedBuidlerConfig = {
solc: {
version: "0.6.4",
optimizer: {
runs: 200,
enabled: true,
}
},
}

export default config;
32 changes: 32 additions & 0 deletions buidler.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
require("dotenv").config();
import { BuidlerConfig, usePlugin } from "@nomiclabs/buidler/config";

usePlugin("buidler-deploy");

interface ExtendedBuidlerConfig extends BuidlerConfig {
[x:string]: any
}

const config: ExtendedBuidlerConfig = {
solc: {
version: "0.6.4",
optimizer: {
runs: 200,
enabled: true,
}
},
networks: {
goerli: {
url: `https://goerli.infura.io/v3/${process.env.INFURA_PROJECT_ID}`,
accounts: [process.env.GOERLI_PRIVATE_KEY]
},
forked: {
url: "http://127.0.0.1:8545",
},
},
namedAccounts: {
deployer: 0,
},
}

export default config;
8 changes: 8 additions & 0 deletions contracts/IRegistry.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pragma solidity 0.6.4;

interface IRegistry {
function inRegistry(address _pool) external view returns(bool);
function entries(uint256 _index) external view returns(address);
function addSmartPool(address _smartPool) external;
function removeSmartPool(uint256 _index) external;
}
27 changes: 27 additions & 0 deletions contracts/Registry.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
pragma solidity 0.6.4;

import "./IRegistry.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract SmartPoolRegistry is IRegistry, Ownable {
mapping(address => bool) public override inRegistry;
address[] public override entries;

function addSmartPool(address _smartPool) external override onlyOwner {
require(!inRegistry[_smartPool], "SmartPoolRegistry.addSmartPool: POOL_ALREADY_IN_REGISTRY");
entries.push(_smartPool);
inRegistry[_smartPool] = true;
}

function removeSmartPool(uint256 _index) external override onlyOwner {
address registryAddress = entries[_index];

inRegistry[registryAddress] = false;

// Move last to index location
entries[_index] = entries[entries.length - 1];
// Pop last one off
entries.pop();
}

}
17 changes: 17 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "@pie-dao/smart-pools-registry",
"version": "0.1.0",
"main": "index.js",
"repository": "https://github.com/MickdeGraaf/smart-pools-registry.git",
"author": "Mick de Graaf <[email protected]>",
"license": "MIT",
"scripts": {
"compile": "npx buidler compile --config buidler.compile.config.ts"
},
"dependencies": {
"@nomiclabs/buidler": "^1.4.3",
"@openzeppelin/contracts": "^3.1.0",
"ts-node": "^8.10.2",
"typescript": "^3.9.7"
}
}
19 changes: 19 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"strict": false,
"esModuleInterop": true,
"outDir": "dist",
"resolveJsonModule": true,
"strictNullChecks": false,
},
"include": ["./scripts", "./test"],
"files": [
"./buidler.config.ts",
"node_modules/@nomiclabs/buidler-ethers/src/type-extensions.d.ts",
"node_modules/@nomiclabs/buidler-etherscan/src/type-extensions.d.ts",
"node_modules/@nomiclabs/buidler-waffle/src/type-extensions.d.ts",
"node_modules/buidler-typechain/src/type-extensions.d.ts"
]
}
Loading

0 comments on commit bc0b27a

Please sign in to comment.