forked from ubiquity/ubiquity-dollar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4fbbb39
commit 0b6b977
Showing
11 changed files
with
1,355 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.sol linguist-language=Solidity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[submodule "contracts"] | ||
path = contracts | ||
url = https://github.com/ubiquity/uad-contracts | ||
branch = main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# dynamic-uad-ui | ||
|
||
after git clone the project make sure to run | ||
|
||
`$ git submodule update --init --recursive --remote` | ||
|
||
You need to create `.env` file inside the contracts folder with at least the ALCHEMY_API_KEY filled. | ||
|
||
then run `$ yarn start` | ||
it will create a file inside `frontend/src` called **uad-contracts-deployment.json** where you can find all the address of the deployed contracts | ||
|
||
it will launch a local node on port **8545** you can check the log in the root file `local.node.log` | ||
after the node is launched it will build and run the front on port **3000** | ||
|
||
make sure to switch to the hardhat network on metamask | ||
|
||
- **chain ID:** 31337 | ||
- **RPC URL:** http://127.0.0.1:8545 | ||
|
||
to get the types from the smart contracts you can import from `contracts/artifacts/types` | ||
|
||
``` | ||
import { UbiquityAlgorithmicDollar } from "../artifacts/types/UbiquityAlgorithmicDollar"; | ||
const token = (await ethers.getContractAt("UbiquityAlgorithmicDollar", uAD.address)) as UbiquityAlgorithmicDollar; | ||
const [sender] = await ethers.getSigners(); | ||
const tx = await token.transfer("0x000000000", 100); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"license": "MIT", | ||
"scripts": { | ||
"start": "echo 'front'" | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
# yarn lockfile v1 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env node | ||
|
||
const args = process.argv.slice(2); | ||
|
||
const fs = require("fs"); | ||
const path = require("path"); | ||
|
||
// console.log({ | ||
// "process.cwd()": process.cwd(), | ||
// "path.resolve(deployment)": path.resolve(args[0]) | ||
// }); | ||
|
||
const deployment = require(path.resolve(args[0])); | ||
|
||
try { | ||
const localhost = deployment[31337].localhost; | ||
fs.writeFileSync(path.resolve(args[1]), JSON.stringify(localhost)); | ||
} catch (e) { | ||
console.error(e); | ||
process.exit(1); | ||
} | ||
|
||
process.exit(0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
if [ -f ./contracts/.env ] | ||
then | ||
export $(cat ./contracts/.env | sed 's/#.*//g' | xargs) | ||
else | ||
echo "Please add a .env inside the contracts folder." | ||
exit 1 | ||
fi | ||
rm -f ./frontend/src/uad-contracts-deployment.json | ||
cd ./contracts || echo "ERROR: ./contracts/ doesn't exist?" | ||
|
||
yarn && yarn compile | ||
kill $(lsof -t -i:8545) || true | ||
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 & | ||
sleep 10 | ||
while : ; do | ||
[[ -f "tmp-uad-contracts-deployment.json" ]] && break | ||
echo "Pausing until uad-contracts-deployment.json exists." | ||
sleep 5 | ||
done | ||
node ../hooks/process-deployment.js ./tmp-uad-contracts-deployment.json ../frontend/src/uad-contracts-deployment.json | ||
rm -f ./tmp-uad-contracts-deployment.json | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"license": "MIT", | ||
"scripts": { | ||
"prestart": "cd ./frontend/ && yarn install && cd ..", | ||
"start": "./hooks/start.sh", | ||
"poststart": "cd ./frontend/ && yarn start", | ||
"stop": "kill $(lsof -t -i:8545) || true", | ||
"poststop": "echo 'exited successfully'" | ||
}, | ||
"dependencies": { | ||
"nodemon": "^2.0.7", | ||
"npm-run-all": "^4.1.5" | ||
}, | ||
"nodemonConfig": { | ||
"ignore": [ | ||
"**/*/cache/", | ||
"**/*/artifacts/", | ||
"**/*/frontend/", | ||
"**/*/node_modules/**/*" | ||
], | ||
"events": { | ||
"config": "exit", | ||
"exit": "", | ||
"restart": "clear && printf '\\033[3J'", | ||
"start": "clear && printf '\\033[3J'" | ||
} | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^15.0.2" | ||
} | ||
} |
Oops, something went wrong.