Skip to content

Commit

Permalink
feat(core): add tasks to manage artifacts and deployments (UMAprotoco…
Browse files Browse the repository at this point in the history
  • Loading branch information
mrice32 authored Jul 30, 2021
1 parent a7fcf55 commit 15a8f31
Show file tree
Hide file tree
Showing 32 changed files with 5,557 additions and 5,522 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ dist
cache
types
contract-types
generated
typechain
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ antora.yml
.eslintcache
.idea
optimism
generated
typechain

# GAE deployment files and directories for GAE deployments.
app.yaml
Expand Down
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ cache
.github
types
contract-types
generated
typechain
21 changes: 12 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"description": "UMA monorepo containing protocol packages",
"private": true,
"scripts": {
"bootstrap": "npx lerna bootstrap",
"lint": "npm run eslint && npm run prettier -- --list-different",
"lint-fix": "npm run eslint -- --fix && npm run prettier -- --write",
"bootstrap": "yarn",
"lint": "yarn eslint && yarn prettier --list-different",
"lint-fix": "yarn eslint --fix && yarn prettier --write",
"eslint": "eslint './**/*.js' './**/*.ts'",
"prettier": "prettier './**/*.js' './**/*.sol' './**/*.md' './**/*.ts'",
"test": "lerna run --stream --concurrency=4 test",
Expand All @@ -31,7 +31,7 @@
"devDependencies": {
"@antora/cli": "^2.1.2",
"@antora/site-generator-default": "^2.1.2",
"@typechain/ethers-v5": "^6.0.5",
"@typechain/ethers-v5": "^7.0.1",
"@typescript-eslint/eslint-plugin": "^4.14.1",
"@typescript-eslint/parser": "^4.14.1",
"babel-eslint": "10.0.1",
Expand All @@ -52,12 +52,13 @@
"lint-staged": "^10.1.3",
"lodash.startcase": "^4.4.0",
"prettier": "2.2.1",
"prettier-plugin-solidity": "^1.0.0-beta.10",
"prettier-plugin-solidity": "1.0.0-beta.10",
"pretty-quick": "^2.0.1",
"secp256k1": "^3.7.1",
"solc-0.8": "npm:solc@^0.8.4",
"truffle": "^5.2.3",
"web3": "^1.3.5"
"typescript": "^4.3.5",
"web3": "^1.5.0"
},
"resolutions": {
"sse4_crc32": "npm:@node-rs/[email protected]"
Expand All @@ -70,7 +71,9 @@
"lint-staged": {
"*.{js,ts,tsx}": "eslint --cache --fix"
},
"workspaces": [
"packages/**"
]
"workspaces": {
"packages": [
"packages/*"
]
}
}
3 changes: 2 additions & 1 deletion packages/affiliates/libs/uniswap/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ export const Balances = () => {
let total = 0n;
const store = new Map<Id, string>();
function getOrCreate(address: string) {
if (store.has(address)) return store.get(address);
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
if (store.has(address)) return store.get(address)!; // Null assertion because we know the map element exists.
return create(address);
}
function create(addr: string) {
Expand Down
5 changes: 3 additions & 2 deletions packages/affiliates/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"@uniswap/v3-core": "1.0.0-rc.2",
"@uniswap/v3-periphery": "1.0.0-beta.23",
"cli-progress": "^3.8.2",
"ethers": "^5.0.17",
"ethers": "^5.4.2",
"googleapis": "39",
"highland": "^2.13.5",
"lodash": "^4.17.20",
Expand All @@ -21,7 +21,8 @@
},
"devDependencies": {
"mocha": "^8.2.0",
"tape": "^5.0.1"
"tape": "^5.0.1",
"@openzeppelin/contracts": "4.1.0"
},
"publishConfig": {
"registry": "https://registry.npmjs.com/",
Expand Down
5 changes: 2 additions & 3 deletions packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
"@types/url-join": "^4.0.0",
"@typescript-eslint/parser": "^4.24.0",
"ts-mocha": "^8.0.0",
"ts-node": "^9.1.1",
"typescript": "^4.1.3"
"ts-node": "^10.1.0"
},
"dependencies": {
"@types/express": "^4.17.11",
Expand All @@ -22,7 +21,7 @@
"@uma/sdk": "^0.4.1",
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"ethers": "^5.1.3",
"ethers": "^5.4.2",
"express": "^4.17.1",
"isomorphic-fetch": "^3.0.0",
"lodash": "^4.17.21",
Expand Down
4 changes: 2 additions & 2 deletions packages/api/src/libs/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { utils, BigNumber, Contract } from "ethers";
import assert from "assert";
const { parseUnits, parseBytes32String } = utils;

export const SCALING_MULTIPLIER = parseUnits("1");
export const SCALING_MULTIPLIER: BigNumber = parseUnits("1");
export type BigNumberish = number | string | BigNumber;

export { parseUnits };
Expand All @@ -28,7 +28,7 @@ export function calcGcr(
uma.tables.emps.Data,
"totalTokensOutstanding" | "totalPositionCollateral" | "tokenDecimals" | "collateralDecimals"
>
) {
): BigNumber {
const { totalTokensOutstanding, totalPositionCollateral, tokenDecimals, collateralDecimals } = params;
assert(uma.utils.exists(totalTokensOutstanding), "requires total tokens outstanding");
assert(uma.utils.exists(totalPositionCollateral), "requires total position collateral");
Expand Down
4 changes: 2 additions & 2 deletions packages/bot-strategy-runner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
"commander": "^7.2.0",
"lodash": "^4.17.21",
"node-fetch": "^2.6.1",
"typescript": "^4.2.2",
"winston-transport": "^4.4.0"
},
"devDependencies": {
"@types/bluebird": "^3.5.33",
"@types/cli-progress": "^3.9.1",
"@types/commander": "^2.12.2",
"@types/mocha": "^8.2.2",
"@types/node-fetch": "^2.5.8"
"@types/node-fetch": "^2.5.8",
"web3": "^1.5.0"
},
"publishConfig": {
"registry": "https://registry.npmjs.com/",
Expand Down
6 changes: 6 additions & 0 deletions packages/bot-strategy-runner/test/ConfigBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Web3 from "web3";
const { isAddress } = Web3.utils;

import { strategyRunnerConfig, buildBotConfigs, buildGlobalWhitelist } from "../src/ConfigBuilder";
import { getWeb3 } from "@uma/common";

// simple config with a permalink to a white lists.
const minimalConfig: strategyRunnerConfig = {
Expand Down Expand Up @@ -35,6 +36,11 @@ const minimumRequiredConfigKeys = [
"pollingDelay",
];
describe("buildGlobalWhitelist", async function () {
before(async () => {
// Web3 instance (for some reason) needs to be warmed up.
const web3 = getWeb3(minimalConfig.botNetwork);
await web3.eth.getAccounts();
});
it("Correctly fetches global whitelist", async function (this: any) {
this.timeout(60000);
// Construct a whitelist from all current EMPs on the affiliates payout. Append a sample address to the list.
Expand Down
7 changes: 4 additions & 3 deletions packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@
"hardhat": "^2.5.0",
"hardhat-deploy": "^0.8.11",
"hardhat-gas-reporter": "^1.0.4",
"hardhat-typechain": "^0.3.5",
"lodash.uniqby": "^4.7.0",
"minimist": "^1.2.0",
"moment": "^2.24.0",
"node-metamask": "github:UMAprotocol/node-metamask",
"require-context": "^1.1.0",
"solidity-coverage": "^0.7.13",
"truffle-deploy-registry": "^0.5.1",
"web3": "^1.3.5"
"web3": "^1.5.0"
},
"devDependencies": {
"@eth-optimism/hardhat-ovm": "^0.2.2",
Expand All @@ -62,7 +64,6 @@
"@tsconfig/node14": "^1.0.0",
"@types/ethereum-protocol": "^1.0.0",
"@types/mocha": "^5.2.7",
"ethers": "^5.4.1",
"typescript": "^4.1.3"
"ethers": "^5.4.2"
}
}
12 changes: 1 addition & 11 deletions packages/common/src/HardhatConfig.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { getNodeUrl, mnemonic } = require("./TruffleConfig");
const path = require("path");

// eslint-disable-next-line no-unused-vars
function getHardhatConfig(configOverrides, workingDir = "./", includeTruffle = true) {
// Hardhat plugins. These are imported inside `getHardhatConfig` so that other packages importing this function
// get access to the plugins as well.
Expand Down Expand Up @@ -88,16 +88,6 @@ function getHardhatConfig(configOverrides, workingDir = "./", includeTruffle = t
apiKey: process.env.ETHERSCAN_API_KEY,
},
namedAccounts: { deployer: 0 },
external: {
deployments: {
mainnet: [path.join(workingDir, "build/contracts"), path.join(workingDir, "deployments/mainnet")],
mumbai: [path.join(workingDir, "build/contracts"), path.join(workingDir, "deployments/mumbai")],
matic: [path.join(workingDir, "build/contracts"), path.join(workingDir, "deployments/matic")],
rinkeby: [path.join(workingDir, "build/contracts"), path.join(workingDir, "deployments/rinkeby")],
kovan: [path.join(workingDir, "build/contracts"), path.join(workingDir, "deployments/kovan")],
goerli: [path.join(workingDir, "build/contracts"), path.join(workingDir, "deployments/goerli")],
},
},
};

return { ...defaultConfig, ...configOverrides };
Expand Down
Loading

0 comments on commit 15a8f31

Please sign in to comment.