Skip to content

Commit

Permalink
Review comments update
Browse files Browse the repository at this point in the history
  • Loading branch information
VSaric committed Jan 21, 2022
1 parent 19ef448 commit f5f97d9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 35 deletions.
2 changes: 1 addition & 1 deletion src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ input[type='radio'] {
margin: 0 5px 0 5px;
}

#libraryLabel {
.libraryLabel {
font-size: large;
}

Expand Down
6 changes: 3 additions & 3 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ <h1 id="logo-text" class="text-center">
</div>
</header>
<section>
<form name="myForm" class="form">
<form name="librarySwitchForm" class="form">
<div class="row justify-content-center">
<div class="justify-content-center">
<input type="radio" id="radio-ethers" name="libraryUsed" value="ethers" />
<label id="libraryLabel">Ethers</label>
<label class="libraryLabel">Ethers</label>
<input type="radio" id="radio-web3" name="libraryUsed" value="web3" />
<label id="libraryLabel">Web3</label>
<label class="libraryLabel">Web3</label>
</div>
</div>
</form>
Expand Down
48 changes: 17 additions & 31 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,22 +192,14 @@ function initializeLibrarySwitches() {
function handleLibraryChange(event) {
libraryInUse = event.target.value;
if (libraryInUse === 'web3') {
// Deployed piggy bank smart contract with web3 library
piggyBankContract = web3PiggyBankContract;
// Deployed hst smart contract with web3 library
hstContract = web3HstContract;
// Deployed collectibles smart contract with web3 library
collectiblesContract = web3CollectiblesContract;
// Deployed failing smart contract with web3 library
failingContract = web3FailingContract;
} else {
// Deployed piggy bank smart contract with ethers library
piggyBankContract = ethersPiggyBankContract;
// Deployed hst smart contract with ethers library
hstContract = ethersHstContract;
// Deployed collectibles smart contract with ethers library
collectiblesContract = ethersCollectiblesContract;
// Deployed failing smart contract with ethers library
failingContract = ethersFailingContract;
}

Expand All @@ -217,7 +209,7 @@ function handleLibraryChange(event) {
depositButton.disabled = false;
withdrawButton.disabled = false;
} else {
contractStatus.innerHTML = 'Not clicked';
contractStatus.innerHTML = 'Not deployed';
depositButton.disabled = true;
withdrawButton.disabled = true;
}
Expand Down Expand Up @@ -258,11 +250,9 @@ function handleLibraryChange(event) {
failingContractStatus.innerHTML = 'Deployed';
sendFailingButton.disabled = false;
} else {
failingContractStatus.innerHTML = 'Not clicked';
failingContractStatus.innerHTML = 'Not deployed';
sendFailingButton.disabled = true;
}

console.log(libraryInUse);
}

const initialize = async () => {
Expand Down Expand Up @@ -497,8 +487,12 @@ const initialize = async () => {
})
.then((receipt) => {
console.log(receipt);
contractStatus.innerHTML = 'Deposit completed';
})
.catch((error) => {
console.log(error);
contractStatus.innerHTML = 'Contract call error';
});
contractStatus.innerHTML = 'Deposit completed';
};
}

Expand All @@ -520,12 +514,14 @@ const initialize = async () => {
})
.then((receipt) => {
console.log(receipt);
contractStatus.innerHTML = 'Withdrawn';
})
.catch((error) => {
console.log(error);
contractStatus.innerHTML = 'Contract call error';
});
contractStatus.innerHTML = 'Withdrawn';
};
}

console.log(piggyBankContract);
};

deployFailingButton.disabled = false;
Expand Down Expand Up @@ -602,9 +598,7 @@ const initialize = async () => {
.send({
from: accounts[0],
})
.then((receipt) => {
console.log(receipt);
});
.then((receipt) => console.log(receipt));
collectiblesStatus.innerHTML = 'Mint completed';
};
}
Expand Down Expand Up @@ -712,9 +706,7 @@ const initialize = async () => {
gas: 60000,
gasPrice: '20000000000',
})
.then((receipt) => {
console.log(receipt);
});
.then((receipt) => console.log(receipt));
};
}

Expand All @@ -741,9 +733,7 @@ const initialize = async () => {
gas: 60000,
gasPrice: '20000000000',
})
.then((receipt) => {
console.log(receipt);
});
.then((receipt) => console.log(receipt));
};
}

Expand All @@ -767,9 +757,7 @@ const initialize = async () => {
from: accounts[0],
gasPrice: '20000000000',
})
.then((receipt) => {
console.log(receipt);
});
.then((receipt) => console.log(receipt));
};
}

Expand All @@ -793,9 +781,7 @@ const initialize = async () => {
from: accounts[0],
gasPrice: '20000000000',
})
.then((receipt) => {
console.log(receipt);
});
.then((receipt) => console.log(receipt));
};
}
};
Expand Down

0 comments on commit f5f97d9

Please sign in to comment.