A recent judgment from China’s Shanghai High People’s Court has given the country’s experiment with cryptocurrency a fresh twist. While China’s expulsion of crypto miners and other judgments had effectively restricted crypto trading and associated operations within its borders, the Shanghai ruling may provide some relief to the community. The judgment in question found Bitcoin […]
CRYPTO NEWS
Bitcoin Is Now Identified as a Legal Virtual Asset Property by the Shanghai High Court
There are two things I want to do with Hardhat that I cannot figure out. The first is having a test pass when the "require" logic inside my contract causes a transaction to fail. As a simple example, if my hardhat test code runs: await myContract.connect(contractOwner).foo(0) and inside my contract I have the foo() function:::Listen
There are two things I want to do with Hardhat that I cannot figure out. The first is having a test pass when the "require" logic inside my contract causes a transaction to fail.
As a simple example, if my hardhat test code runs:
await myContract.connect(contractOwner).foo(0)
and inside my contract I have the foo() function:
function foo(uint8 num) public { require(num > 0, "Number must be greater than 0"); ... ... }
My hardhat test will then fail, even though what I am testing is actually behaving like I want it to.
The second is viewing emitted events. I want to make sure my events have fired, but there is no way for me to see anything related to that. In my code I have defined
event MarketItemMinted(uint256 indexed tokenId, address creator);
and in my function I call
emit MarketItemMinted(newTokenId, creator);
I don’t see any errors. In my Hardhat test I am printing out the transaction and I don’t see anything related to my emitted events:
{ hash: '0x0301118fb00cd1b27f085d4c0103eb4196c7cc28017de98bd34f6368179188c5', type: 2, accessList: [], blockHash: '0xb84abcf841199730a892e50d38d99cf73006f85f50e6f92ca01addcc8617ce51', blockNumber: 3, transactionIndex: 0, confirmations: 1, from: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', gasPrice: BigNumber { value: "1694690631" }, maxPriorityFeePerGas: BigNumber { value: "1000000000" }, maxFeePerGas: BigNumber { value: "2389381262" }, gasLimit: BigNumber { value: "29030424" }, to: '0x5FbDB2315678afecb367f032d93F642f64180aa3', value: BigNumber { value: "1000000000000000000" }, nonce: 2, data: '0x30a631e9000000000000000000000000000000000000000000000000000000000000008000000000000000000000000070997970c51812dc3a010c7d01b50e0d17dc79c80000000000000000000000003c44cdddb6a900fa2b585dd299e03d12fa4293bc0000000000000000000000000000000000000000000000000058d15e176280000000000000000000000000000000000000000000000000000000000000000050697066733a2f2f626166797265696637626d636736676d647371696d6265746533656434696a786f6661746132337764736268687137626a69696d626570346d6b692f6d657461646174612e6a736f6e00000000000000000000000000000000', r: '0x328d13a9c4be32a2f7020926f0ef5ea5385c7e872dc909d26c81f2f74a09a47b', s: '0x3cce5e39c56f1a9e300fc3c5f3f018f9886aabe143e4e64a4166954fd2640705', v: 0, creates: null, chainId: 31337, wait: [Function (anonymous)] }
Showing 1–8 of 312 results
-
Electroneum ETN Unisex Twill Crypto Hat
USD$25.30 Select options -
Pearl Crypto Coin Unisex Trucker Hat
USD$28.08 Select options -
Insight Chain INB Crypto Coin Unisex Trucker Hat
USD$28.08 Select options -
DASH Unisex Twill Crypto Hat
USD$25.30 Select options -
Naga NGC Crypto Coin Unisex Trucker Hat
USD$28.08 Select options -
Paypex PAYX Crypto Coin Unisex Trucker Hat
USD$28.08 Select options -
Poet POE Crypto Coin Unisex Trucker Hat
USD$28.08 Select options -
Cardano ADA Unisex Twill Crypto Hat
USD$25.30 Select options
