Skip to content

Commit 0b6b977

Browse files
committed
first commit
1 parent 4fbbb39 commit 0b6b977

11 files changed

+1355
-0
lines changed

Diff for: .gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.sol linguist-language=Solidity

Diff for: .gitmodules

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[submodule "contracts"]
2+
path = contracts
3+
url = https://github.com/ubiquity/uad-contracts
4+
branch = main

Diff for: README.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# dynamic-uad-ui
2+
3+
after git clone the project make sure to run
4+
5+
`$ git submodule update --init --recursive --remote`
6+
7+
You need to create `.env` file inside the contracts folder with at least the ALCHEMY_API_KEY filled.
8+
9+
then run `$ yarn start`
10+
it will create a file inside `frontend/src` called **uad-contracts-deployment.json** where you can find all the address of the deployed contracts
11+
12+
it will launch a local node on port **8545** you can check the log in the root file `local.node.log`
13+
after the node is launched it will build and run the front on port **3000**
14+
15+
make sure to switch to the hardhat network on metamask
16+
17+
- **chain ID:** 31337
18+
- **RPC URL:** http://127.0.0.1:8545
19+
20+
to get the types from the smart contracts you can import from `contracts/artifacts/types`
21+
22+
```
23+
import { UbiquityAlgorithmicDollar } from "../artifacts/types/UbiquityAlgorithmicDollar";
24+
25+
const token = (await ethers.getContractAt("UbiquityAlgorithmicDollar", uAD.address)) as UbiquityAlgorithmicDollar;
26+
27+
const [sender] = await ethers.getSigners();
28+
29+
const tx = await token.transfer("0x000000000", 100);
30+
31+
```

Diff for: contracts

Submodule contracts added at 330b16c

Diff for: frontend/package.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"license": "MIT",
3+
"scripts": {
4+
"start": "echo 'front'"
5+
}
6+
}

Diff for: frontend/src/uad-contracts-deployment.json

+1
Large diffs are not rendered by default.

Diff for: frontend/yarn.lock

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2+
# yarn lockfile v1
3+
4+

Diff for: hooks/process-deployment.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env node
2+
3+
const args = process.argv.slice(2);
4+
5+
const fs = require("fs");
6+
const path = require("path");
7+
8+
// console.log({
9+
// "process.cwd()": process.cwd(),
10+
// "path.resolve(deployment)": path.resolve(args[0])
11+
// });
12+
13+
const deployment = require(path.resolve(args[0]));
14+
15+
try {
16+
const localhost = deployment[31337].localhost;
17+
fs.writeFileSync(path.resolve(args[1]), JSON.stringify(localhost));
18+
} catch (e) {
19+
console.error(e);
20+
process.exit(1);
21+
}
22+
23+
process.exit(0);

Diff for: hooks/start.sh

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
if [ -f ./contracts/.env ]
4+
then
5+
export $(cat ./contracts/.env | sed 's/#.*//g' | xargs)
6+
else
7+
echo "Please add a .env inside the contracts folder."
8+
exit 1
9+
fi
10+
rm -f ./frontend/src/uad-contracts-deployment.json
11+
cd ./contracts || echo "ERROR: ./contracts/ doesn't exist?"
12+
13+
yarn && yarn compile
14+
kill $(lsof -t -i:8545) || true
15+
yarn hardhat node --fork https://eth-mainnet.alchemyapi.io/v2/$ALCHEMY_API_KEY --fork-block-number 12150000 --show-accounts --export-all tmp-uad-contracts-deployment.json > ../local.node.log 2>&1 &
16+
sleep 10
17+
while : ; do
18+
[[ -f "tmp-uad-contracts-deployment.json" ]] && break
19+
echo "Pausing until uad-contracts-deployment.json exists."
20+
sleep 5
21+
done
22+
node ../hooks/process-deployment.js ./tmp-uad-contracts-deployment.json ../frontend/src/uad-contracts-deployment.json
23+
rm -f ./tmp-uad-contracts-deployment.json
24+
exit 0

Diff for: package.json

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"license": "MIT",
3+
"scripts": {
4+
"prestart": "cd ./frontend/ && yarn install && cd ..",
5+
"start": "./hooks/start.sh",
6+
"poststart": "cd ./frontend/ && yarn start",
7+
"stop": "kill $(lsof -t -i:8545) || true",
8+
"poststop": "echo 'exited successfully'"
9+
},
10+
"dependencies": {
11+
"nodemon": "^2.0.7",
12+
"npm-run-all": "^4.1.5"
13+
},
14+
"nodemonConfig": {
15+
"ignore": [
16+
"**/*/cache/",
17+
"**/*/artifacts/",
18+
"**/*/frontend/",
19+
"**/*/node_modules/**/*"
20+
],
21+
"events": {
22+
"config": "exit",
23+
"exit": "",
24+
"restart": "clear && printf '\\033[3J'",
25+
"start": "clear && printf '\\033[3J'"
26+
}
27+
},
28+
"devDependencies": {
29+
"@types/node": "^15.0.2"
30+
}
31+
}

0 commit comments

Comments
 (0)