Skip to content

Commit

Permalink
Upgrade repos in set protocol viewers
Browse files Browse the repository at this point in the history
  • Loading branch information
justinkchen committed May 4, 2020
1 parent 34aa7b6 commit 2dcd5ba
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 31 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
steps:
- checkout
- setup_remote_docker:
docker_layer_caching: true
docker_layer_caching: false
- restore_cache:
key: module-cache-{{ checksum "yarn.lock" }}
- run:
Expand All @@ -32,7 +32,7 @@ jobs:
parallelism: 2
steps:
- setup_remote_docker:
docker_layer_caching: true
docker_layer_caching: false
- run:
name: Fetch solc version
command: docker pull ethereum/solc:0.5.7
Expand All @@ -56,7 +56,7 @@ jobs:
working_directory: ~/set-protocol-viewers
steps:
- setup_remote_docker:
docker_layer_caching: true
docker_layer_caching: false
- run:
name: Fetch solc version
command: docker pull ethereum/solc:0.5.4
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "set-protocol-viewers",
"version": "1.0.10",
"version": "1.0.11",
"main": "dist/artifacts/index.js",
"typings": "dist/typings/artifacts/index.d.ts",
"files": [
Expand All @@ -23,7 +23,7 @@
"coverage-cleanup": "find artifacts/ts -name \\*.js* -type f -delete && find test -name \\*.js* -type f -delete && find types -name \\*.js* -type f -delete && find utils -name \\*.js* -type f -delete",
"coverage-continuous": "./node_modules/.bin/solidity-coverage",
"coverage-setup": "yarn transpile && cp -r transpiled/artifacts/ts/* artifacts/ts/. && cp -r transpiled/test/contracts/* test/. && cp -r transpiled/types/* types/. && cp -r transpiled/utils/* utils/.",
"deploy-development": "bash scripts/deploy_development.sh",
"deploy-development": "bash scripts/deploy_development.sh && yarn transformJson",
"delete-dev-addresses": "jq 'del(.development)' ./deployments/outputs.json > outputs.tmp && mv outputs.tmp ./deployments/outputs.json && bash scripts/generate_outputs.sh && git add .",
"dist": "yarn setup && bash scripts/prepare_dist.sh",
"generate-typings": "set-abi-gen --abis './build/contracts/*.json' --out './types/generated' --template './types/contract_templates/contract.mustache' --partials './types/contract_templates/partials/*.mustache'",
Expand All @@ -38,6 +38,7 @@
"test-nocompile": "yarn transpile && yarn truffle-test-contracts",
"test-continuous": "yarn deploy-development && yarn test",
"transpile": "tsc",
"transformJson": "node scripts/transform_contract_json.js",
"truffle-test-contracts": "truffle test `find transpiled/test/contracts/viewer -name '*.spec.js'`",
"prepublishOnly": "yarn dist",
"flatten": "truffle-flattener contracts/managers/SocialTradingManager.sol",
Expand Down Expand Up @@ -99,9 +100,9 @@
"minify-all": "^1.2.2",
"module-alias": "^2.1.0",
"openzeppelin-solidity": "^2.2",
"set-protocol-contracts": "^1.4.1-beta",
"set-protocol-strategies": "^1.1.36",
"set-protocol-oracles": "^1.0.15",
"set-protocol-contracts": "^1.4.5-beta",
"set-protocol-strategies": "^1.1.37",
"set-protocol-oracles": "^1.0.16",
"set-protocol-utils": "^1.1.2",
"tiny-promisify": "^1.0.0",
"truffle-flattener": "^1.4.2",
Expand Down
13 changes: 6 additions & 7 deletions scripts/deploy_development.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

# NOTE: This script is intended for use by external repos that depend
# on the Set Protocol smart contracts in any capacity. To deploy the Set Protocol
# smart contracts on your local blockchain environment,
Expand Down Expand Up @@ -31,19 +33,16 @@ mkdir artifacts/json
cp build/contracts/* artifacts/json/

# Remove old transpiled artifacts from the artifacts/ directory
rm artifacts/ts/*


rm -rf artifacts/ts/*

# Transform raw JSON artifacts into Typescript modules. This makes
# interacting with the artifacts significantly easier when exporting
# them as modules.
for filename in build/contracts/*.json; do
filename_base=$(basename $filename .json)
echo -e "export const $filename_base = " > "artifacts/ts/$filename_base.ts"
cat "build/contracts/$filename_base.json" >> "artifacts/ts/$filename_base.ts"
filename_base=$(basename $filename .json)

echo -e "Transpiled $filename_base.json into $filename_base.ts"
# Add export lines to artifacts/ts/index.ts so types will works
echo -e "export { $filename_base } from \"./$filename_base\";" >> artifacts/ts/index.ts
done

echo -e "Successfully deployed contracts onto Development Testnet!"
27 changes: 27 additions & 0 deletions scripts/transform_contract_json.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//requiring path and fs modules
const path = require('path');
const fs = require('fs');
//joining path of directory
const directoryPath = path.join(__dirname, '../artifacts/json');

//passsing directoryPath and callback function
fs.readdir(directoryPath, function (err, files) {
//handling error
if (err) {
return console.log('Unable to scan directory: ' + err);
}
//listing all files using forEach
files.forEach(function (file) {
const baseName = file.replace('.json', '');
const filePath = path.join(__dirname, '../artifacts/json', file);
const newPath = path.join(__dirname, '../artifacts/ts', `${baseName}.ts`);
const contents = fs.readFileSync(filePath, 'utf8');
let json = JSON.parse(contents);
delete json["ast"]
delete json["legacyAST"]

fs.writeFileSync(newPath, `export const ${baseName} = `);
fs.appendFileSync(newPath, `${JSON.stringify(json)}`);
console.log(`Finished writing to ${newPath}`);
});
});
60 changes: 44 additions & 16 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6380,10 +6380,36 @@ set-immediate-shim@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz#4b2b1b27eb808a9f8dcc481a58e5e56f599f3f61"

set-protocol-contracts@^1.4.1-beta:
version "1.4.1-beta"
resolved "https://registry.yarnpkg.com/set-protocol-contracts/-/set-protocol-contracts-1.4.1-beta.tgz#68eecdba8511ef38b94c39ae086010ea4cc135db"
integrity sha512-Tb/RzqIQHwcp9t2PJbFnQBvbwr2sxd34qEVWSi8P91IHhWnaQdEntWwJsAcq2AouVyS8BC0JTm7lH2XMu8kIIQ==
set-protocol-contract-utils@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/set-protocol-contract-utils/-/set-protocol-contract-utils-1.0.3.tgz#bb388736992774c5f80ce2eaaf027ca6603a5378"
integrity sha512-IugjAig+8XTmN2PF8iHvn/xCAq8TB8xnuCzL6EpkUHnnzd8fxBFFmnnmtGg9Tcg9ntkrhJa2fe6WUWOMa1fH2g==
dependencies:
bn-chai "^1.0.1"
canonical-weth "^1.3.1"
dotenv "^6.2.0"
eth-gas-reporter "^0.1.10"
ethlint "^1.2.3"
expect "^24.1.0"
fs-extra "^5.0.0"
husky "^0.14.3"
lint-staged "^7.2.0"
module-alias "^2.1.0"
openzeppelin-solidity "^2.2"
set-protocol-utils "^1.0.0-beta.45"
tiny-promisify "^1.0.0"
truffle-flattener "^1.4.2"
ts-mocha "^6.0.0"
ts-node "^8.0.2"
tslint-eslint-rules "^5.3.1"
web3 "1.0.0-beta.36"
web3-utils "1.0.0-beta.36"
zos-lib "^2.4.2"

set-protocol-contracts@^1.4.5-beta:
version "1.4.5-beta"
resolved "https://registry.yarnpkg.com/set-protocol-contracts/-/set-protocol-contracts-1.4.5-beta.tgz#6d03e5ad12eaace1f9852a3d3f03cf1b0c5419af"
integrity sha512-if2qgYMnqRwcld/cF+lYnkhZ+52FgLo9Iqgt8v8P+2zanUi/5mj3cVml4EwoenCRuNzZcDlLSGGZ6j3yms0fmQ==
dependencies:
bn-chai "^1.0.1"
canonical-weth "^1.3.1"
Expand All @@ -6397,7 +6423,8 @@ set-protocol-contracts@^1.4.1-beta:
minify-all "^1.2.2"
module-alias "^2.1.0"
openzeppelin-solidity "^2.2"
set-protocol-oracles "^1.0.15"
set-protocol-contract-utils "^1.0.3"
set-protocol-oracles "^1.0.16"
set-protocol-utils "^1.1.2"
tiny-promisify "^1.0.0"
truffle-flattener "^1.4.0"
Expand All @@ -6408,10 +6435,10 @@ set-protocol-contracts@^1.4.1-beta:
web3-utils "1.0.0-beta.36"
zos-lib "^2.4.2"

set-protocol-oracles@^1.0.15:
version "1.0.15"
resolved "https://registry.yarnpkg.com/set-protocol-oracles/-/set-protocol-oracles-1.0.15.tgz#e9189971b7de54150d1420971a951f91ae795a06"
integrity sha512-VAQ/e9XERR+2os+K4rvXKFxptvA44QjKdbYGysOiDNvBr+fAJd9VkOOI7MVl6YPqQWTo/nGG5i2WKTQ4XYUPCQ==
set-protocol-oracles@^1.0.16:
version "1.0.16"
resolved "https://registry.yarnpkg.com/set-protocol-oracles/-/set-protocol-oracles-1.0.16.tgz#15f1cb497feadc10673eb9193406bdd9c33ee3d6"
integrity sha512-nJgi4dVSve0iaeu69U4apeSrBYFWqAuMEUV0wLaiLBDwSdneN4oKSPGVPgdW/HRPyD1PH11WxFiLw/1eUmAOPQ==
dependencies:
bn-chai "^1.0.1"
canonical-weth "^1.3.1"
Expand All @@ -6435,10 +6462,10 @@ set-protocol-oracles@^1.0.15:
web3 "1.0.0-beta.36"
web3-utils "1.0.0-beta.36"

set-protocol-strategies@^1.1.36:
version "1.1.36"
resolved "https://registry.yarnpkg.com/set-protocol-strategies/-/set-protocol-strategies-1.1.36.tgz#82de6eadfa2abe775a871c9a347160fae98e6fcb"
integrity sha512-/J5g1Bf8Fh9CzVIc2hBp+IG+vfBr625+VYPBGK1ec4rI9KVTqiuyjicbJqrWUQwAnyK9qvk6S2vad5wSCzLAVg==
set-protocol-strategies@^1.1.37:
version "1.1.37"
resolved "https://registry.yarnpkg.com/set-protocol-strategies/-/set-protocol-strategies-1.1.37.tgz#daaaf489a2486d0477c81277166fad7ff0d08b3a"
integrity sha512-fg0HVm204DXLgp0lhgP8NPQph5vrWmVCjH7kUl49KlOvIENd03OS+eeBsUL+YGfh4gOsEhkOp6GlpYJ5EyfWAw==
dependencies:
bn-chai "^1.0.1"
canonical-weth "^1.3.1"
Expand All @@ -6452,8 +6479,9 @@ set-protocol-strategies@^1.1.36:
minify-all "^1.2.2"
module-alias "^2.1.0"
openzeppelin-solidity "^2.2"
set-protocol-contracts "^1.4.1-beta"
set-protocol-oracles "^1.0.15"
set-protocol-contract-utils "^1.0.3"
set-protocol-contracts "^1.4.5-beta"
set-protocol-oracles "^1.0.16"
set-protocol-utils "^1.1.2"
tiny-promisify "^1.0.0"
truffle-flattener "^1.4.2"
Expand All @@ -6463,7 +6491,7 @@ set-protocol-strategies@^1.1.36:
web3 "1.0.0-beta.36"
web3-utils "1.0.0-beta.36"

set-protocol-utils@^1.1.2:
set-protocol-utils@^1.0.0-beta.45, set-protocol-utils@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/set-protocol-utils/-/set-protocol-utils-1.1.2.tgz#02d2fabb30bb1be741bad9aede3a058f56a7301d"
integrity sha512-f5vPFbygm3h2ctnc6g/iH3RBqKQsq85M0HGaUxmaz0PkkPPUUjRXv/1Rwu3pDqyLobTVTNBxINWzu0ZgiUEUsg==
Expand Down

0 comments on commit 2dcd5ba

Please sign in to comment.