Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(governance): allow test execution of proposal from tx id (#13509)
* allow test execution of proposal from tx id * parse and pass correctly tx args * add unlock addresses in whales * allow proposal id only for votes * pass odwn tx receipt * herlpes for gov contract * log events after proposal execution * Update governance/scripts/gov/index.js --------- Co-authored-by: Julien Genestoux <julien.genestoux@gmail.com>
- Loading branch information
Showing
14 changed files
with
359 additions
and
199 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const { ethers } = require('hardhat') | ||
const { ADDRESS_ZERO } = require('@unlock-protocol/hardhat-helpers') | ||
|
||
const fetchDataFromTx = async ({ | ||
txHash, | ||
abi, | ||
eventName = 'TransactionAdded', | ||
}) => { | ||
const { interface } = await ethers.getContractAt(abi, ADDRESS_ZERO) | ||
|
||
// fetch data from tx | ||
const { logs } = await ethers.provider.getTransactionReceipt(txHash) | ||
const parsedLogs = logs.map((log) => { | ||
try { | ||
return interface.parseLog(log) | ||
} catch (error) { | ||
return {} | ||
} | ||
}) | ||
const { args } = parsedLogs.find(({ name }) => name === eventName) | ||
return args | ||
} | ||
|
||
module.exports = { | ||
fetchDataFromTx, | ||
} |
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
Oops, something went wrong.