-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding function to start appeal and bootstrap fn
- Loading branch information
1 parent
8d25e38
commit 30595d0
Showing
5 changed files
with
79 additions
and
14 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
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
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,33 @@ | ||
const { ethers, utils } = require("ethers"); | ||
const fs = require('fs'); | ||
const { generate, derive } = require('../libs/address_generator') | ||
|
||
async function main() { | ||
const configs = JSON.parse(fs.readFileSync(process.env.CONFIG).toString()) | ||
const ABI = JSON.parse(fs.readFileSync('./artifacts/contracts/' + configs.contract_name + '.sol/' + configs.contract_name + '.json').toString()) | ||
const provider = new ethers.providers.JsonRpcProvider(configs.provider); | ||
const wallet = new ethers.Wallet(configs.referees[0].key).connect(provider) | ||
const contract = new ethers.Contract(configs.contract_address, ABI.abi, wallet) | ||
|
||
// Working always with last deal | ||
const deal_index = await contract.totalDeals() | ||
|
||
try { | ||
const tx = await contract.startAppeal(deal_index) | ||
console.log('Pending transaction at: ' + tx.hash) | ||
await tx.wait() | ||
console.log('Appeal successfully started at ' + tx.hash + '!') | ||
const appeal = await contract.appeals(deal_index) | ||
console.log("Appeal is:", appeal) | ||
} catch (e) { | ||
console.log(e.message) | ||
console.log('Can\'t create appeal, check transaction.') | ||
} | ||
} | ||
|
||
main() | ||
.then(() => process.exit(0)) | ||
.catch((error) => { | ||
console.error(error); | ||
process.exit(1); | ||
}); |
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
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