You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We need our test dapp to be able to test error cases. A basic error case that we need to add is a transaction with a smart contract, which will always fail because of a condition internal to the smart contract code.
Here is the code for a smart contract. Transactions sent to this contract will always fail if the value of the transaction is less than 0xfff
The following code would create a transaction to deploy this contract:
var mmcheckContract = new web3.eth.Contract([{"payable":true,"stateMutability":"payable","type":"fallback"}]);
var mmcheck = mmcheckContract.deploy({
data: '0x6080604052348015600f57600080fd5b50608b8061001e6000396000f3fe6080604052610fff3411600e57fe5b3373ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f193505050501580156053573d6000803e3d6000fd5b5000fea265627a7a72315820631b0dbb6b871cdbfdec2773af15ebfb8e52c794cf836fe27ec21f1aed17180f64736f6c634300050c0032',
arguments: [
]
}).send({
from: web3.eth.accounts[0],
gas: '4700000'
}, function (e, contract){
console.log(e, contract);
if (typeof contract.address !== 'undefined') {
console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash);
}
})
We need to add a section to the test dapp that has two buttons, one to deploy this contract and one to send a transaction to it.
Acceptance criteria
add a new section to the "Send Eth" card in the test dapp. Add a new <hr> below the current "Contract" section, the section can be very similar to the "Contract" section, except that it should have a new title "Failing Contract", and two buttons: "Deploy Failing Contract" and "Send Failing Transaction"
clicking the "Deploy Failing Contract" button should call code very similar to the current "Deploy" button code, but instead should deploy the contract data 0x6080604052348015600f57600080fd5b50608b8061001e6000396000f3fe6080604052610fff3411600e57fe5b3373ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f193505050501580156053573d6000803e3d6000fd5b5000fea265627a7a72315820631b0dbb6b871cdbfdec2773af15ebfb8e52c794cf836fe27ec21f1aed17180f64736f6c634300050c0032
clicking the "Send Failing Transaction" button should send a transaction with value 0x0 to the address of the new contract (the way that "Deposit" creates a transaction to the address of the contract created by "Deploy")
if done correctly, the transaction created by "Send Failing Transaction" should show an error message, but you should still be able to submit it. However, after submission, it should fail
The text was updated successfully, but these errors were encountered:
We need our test dapp to be able to test error cases. A basic error case that we need to add is a transaction with a smart contract, which will always fail because of a condition internal to the smart contract code.
Here is the code for a smart contract. Transactions sent to this contract will always fail if the value of the transaction is less than 0xfff
The following code would create a transaction to deploy this contract:
We need to add a section to the test dapp that has two buttons, one to deploy this contract and one to send a transaction to it.
Acceptance criteria
<hr>
below the current "Contract" section, the section can be very similar to the "Contract" section, except that it should have a new title "Failing Contract", and two buttons: "Deploy Failing Contract" and "Send Failing Transaction"0x6080604052348015600f57600080fd5b50608b8061001e6000396000f3fe6080604052610fff3411600e57fe5b3373ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f193505050501580156053573d6000803e3d6000fd5b5000fea265627a7a72315820631b0dbb6b871cdbfdec2773af15ebfb8e52c794cf836fe27ec21f1aed17180f64736f6c634300050c0032
0x0
to the address of the new contract (the way that "Deposit" creates a transaction to the address of the contract created by "Deploy")The text was updated successfully, but these errors were encountered: