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
#!/bin/bash | |
home_path=`pwd` | |
service_path="/etc/systemd/system/$1.service" | |
if [ -f "$service_path" ] | |
then | |
echo "Service file already exists, renewing file..." | |
systemctl stop $1.service | |
systemctl disable $1.service | |
rm "$service_path" |
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
#!/bin/bash | |
home_path=$(pwd) | |
wsgi_path="$home_path/wsgi.py" | |
ini_path="$home_path/$1" | |
if [ -f "$ini_path" ] | |
then | |
echo "INI and WSGI files already exists, renewing files..." | |
rm "$wsgi_path" |
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
#!/bin/bash | |
conf_path="/etc/nginx/sites-available/$1" | |
available_path="/etc/nginx/sites-enabled/$1" | |
home_path=$(pwd) | |
if [ -f "$conf_path" ] | |
then | |
echo "NGINX Configuration file already exists, renewing file..." | |
rm "$available_path" |
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
const EscrowContract = await hre.ethers.getContractFactory("Escrow"); | |
const escrowContract = await EscrowContract.deploy(DAITokenAddress) | |
await escrowContract.deployed(); | |
console.log('Contracts deployed!'); | |
if (networkName == 'localhost') { | |
console.log('Deployed ERC20 contract address', erc20.address) | |
} | |
console.log('Deployed Escrow Contract address', escrowContract.address); |
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
let DAITokenAddress = process.env[`${networkName.toUpperCase()}_NETWORK_DAI_TOKEN_ADDRESS`]; | |
// If deploying to localhost, (for dev/testing purposes) need to deploy own ERC20 | |
if (networkName == 'localhost') { | |
const ERC20Contract = await hre.ethers.getContractFactory("MockDaiToken"); | |
erc20 = await ERC20Contract.deploy(); | |
await erc20.deployed() | |
DAITokenAddress = erc20.address | |
} |
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
const networkName = hre.network.name; | |
const networkUrl = hre.network.config.url; | |
console.log('Deploying to network', networkName, networkUrl); |
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
const hre = require('hardhat'); | |
require('dotenv').config(); | |
async function main() { | |
// Insert your deployment script here | |
} | |
// We recommend this pattern to be able to use | |
// async/await everywhere and properly handle errors. | |
main() | |
.then(() => process.exit(0)) | |
.catch((error) => { |
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
require("@nomiclabs/hardhat-ethers"); | |
require('dotenv').config(); | |
/** | |
* @type import('hardhat/config').HardhatUserConfig | |
*/ | |
module.exports = { | |
solidity: "0.8.4", | |
networks: { | |
rinkeby: { | |
url: process.env.RINKEBY_RPC_URL, |
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
it("Unhappy Path: withdrawalEscrow - Transaction hash cannot be empty!", async function () { | |
const contractWithSigner = contract.connect(unhappyPathAccount); | |
let err = ""; | |
try { | |
await contractWithSigner.withdrawalEscrow(ethers.constants.HashZero) | |
} | |
catch(e) { | |
err = e.message; | |
} | |
expect(err).to.equal("VM Exception while processing transaction: reverted with reason string 'Transaction hash cannot be empty!'"); |
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
it("Happy Path: withdrawalEscrow", async function () { | |
const contractWithSigner = contract.connect(happyPathAccount); | |
const trxHash = await contract.getHash(amount); | |
const submitEscrowTx = await contractWithSigner.submitEscrow(trxHash, amount); | |
await submitEscrowTx.wait(); | |
expect( | |
(await erc20.balanceOf(happyPathAccount.address)).toString() | |
).to.equal("50000000000000000000"); | |
const withdrawalEscrowTx = await contractWithSigner.withdrawalEscrow(trxHash); | |
await withdrawalEscrowTx.wait(); |