Skip to content

Instantly share code, notes, and snippets.

@katat
katat / resume.json
Last active September 5, 2023 04:02
{
"basics": {
"name": "Katat Choi",
"label": "Full Stack Developer",
"email": "kata.choi@gmail.com",
"website": "http://katat.me",
"summary": "I have been practicing remote craftmanship with startups across the globe since 2012, experienced in building products from the ground up. Currently, I am looking for opportunities in which I can gain cryptography knowledge at deeper level while making contributions in the blockchain world.",
"profiles": [
{
"network": "Blog",

GrowFi milestone 2 / second round review

The following files are duplicated. The duplicated code is better to be consolidated for the other parts to reference:

  • test/deploy.js and test/deploy/deploy.js
  • test/deploy/exec.js and test/exec.js
  • test/txBuilder.js and test/tx/txBuilder.js
  • test/cellBuilder.js and test/tx/cellBuilder.js

Besides, I don't see there are updates to the contract scripts based on the feedbacks of the first round.

@katat
katat / review.md
Last active August 11, 2020 06:49
GrowFI milestone 2 review feedback

Milestone 2 review

The web app is integrated with the Synapse wallet in a form of Chrome extension, which in turn interacts with the contracts on CKB chain. It achieved all the key functions, such as creating liquidity pool / add liquidity to existing pool / exit from a liquidity pool / swap between UDTs and CKB. Although the UI is working, but I think it will need some polishments to improve the user experiences to be more intuitive.

The integration tests also demonstrates these key functions on UDTSwap are working as expected. There were some problems in the test setup documentation, but they did provide detailed steps for me to be able to setup my local environment to successfully execute these integration tests. I suggested them to encapsulate these complicated setup steps into a script, which they agreed. After some conversions with the team, they did improve the deployment script to be easy enough to run the integration test.

Overall, I think the UDTSwap works as expected as a prototype. It demons

//update staged balance
for(const settlement of settlements.filter(s => s.isStageable)) {
await settlement.stage(wallet, {gasLimit, gasPrice});
}
//withdraw all staged balance for a currency back to base layer
const stagedBalanceBN = await wallet.getNahmiiStagedBalance(tokenInfo.symbol);
const withdrawMonetaryAmount = nahmii.MonetaryAmount.from(stagedBalanceBN, tokenInfo.currency);
await wallet.withdraw(withdrawMonetaryAmount, {gasLimit, gasPrice});
const settlements = await settlementFactory.calculateRequiredSettlements(wallet.address, stageMonetaryAmount);
for (const settlement of settlements) {
const {hash} = await settlement.start(wallet, {gasLimit, gasPrice});
//wait until the transaction is mined on chain
await provider.getTransactionConfirmation(hash);
}
const {hash} = await settlement.start(wallet, {gasLimit, gasPrice});
const settlements = await settlementFactory.getAllSettlements(wallet.address, tokenInfo.currency);
//settlement.type indicates which type the settlement is.
//settlement.isStageable indicates if the settlement is qualified and ready to be staged (marked as completed)
//settlement.isOngoing indicates if the settlement is still within the challenge period.
//settlement.expirationTime indicates the end time of the challenge period.
await settlementFactory.calculateRequiredSettlements(wallet.address, stageMonetaryAmount);
//specify the currency, amount and the recipient address
const payMonetaryAmount = nahmii.MonetaryAmount.from({
currency: {
ct: tokenInfo.currency,
id: '0'
},
amount: ethers.utils.parseUnits(payAmount, tokenInfo.decimals)
});
const payment = new nahmii.Payment(payMonetaryAmount, wallet.address, recipientAddress, wallet);
//approve the deposit amount for the ClientFund contract
await wallet.approveTokenDeposit(depositAmount, tokenInfo.symbol);
//deposit to the ClientFund contract
await wallet.completeTokenDeposit(depositAmount, tokenInfo.symbol);