View Postgres back up and restore
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
Backup | |
`docker exec backend_postgres_1 pg_dump -U swell -W swellnetwork > backup.sql ` | |
Restore: | |
`docker exec backend_postgres_1 psql -U swell -W swellnetwork < backup.sql ` |
View settings.json
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
{ | |
"slither.solcPath": "", | |
"slither.hiddenDetectors": [], | |
"solidity.compileUsingRemoteVersion": "v0.6.12+commit.27d51765", | |
"solidity.nodemodulespackage": "@eth-optimism/solc" | |
} |
View lending_swap.js
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
await dsa.setInstance(237); | |
let withdrawAmount = 1000; | |
let withdrawAmtInWei = dsa.tokens.fromDecimal(withdrawAmount, "bat"); | |
let slippage = 0.1; // 0.1% slippage. | |
let bat_address = dsa.tokens.info.bat.address | |
let usdc_address = dsa.tokens.info.usdc.address | |
let buyAmount = await dsa.kyber.getBuyAmount("USDC", "BAT", withdrawAmount, slippage); |
View .vimrc
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
"-------------------------------- | |
" Vundle | |
"-------------------------------- | |
set nocompatible " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" alternatively, pass a path where Vundle should install plugins |
View instadapp.js
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
async function oneInchSwapQuote(fromToken, toToken, dsa){ | |
const oneInchSwapQuote = await (await fetch(`https://api.1inch.exchange/v1.1/swapQuote?fromTokenSymbol=${fromToken.symbol}&toTokenSymbol=${toToken.symbol}&amount=${fromToken.balance.toString()}&fromAddress=${dsa.instance.address}&slippage=1&disableEstimate=true`)).json(); | |
console.log(`Estimate exchange: ${oneInchSwapQuote.toTokenAmount / (10 ** toToken.decimals)}`) | |
return oneInchSwapQuote; | |
} | |
// Set DSA instance | |
await dsa.setInstance((await dsa.getAccounts())[0].id); | |
// Set up tokens |
View save.js
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
let borrowAmount = 3880; | |
let borrowAmtInWei = dsa.tokens.fromDecimal(borrowAmount, "usdc"); // borrow flash loan and swap via OasisDEX | |
console.log("borrowAmtInWei: ", borrowAmtInWei) | |
let position = await dsa.compound.getPosition(); | |
let wbtcDebtAmount = position.wbtc.borrow; | |
let wbtcDebtAmtInWei = dsa.tokens.fromDecimal(wbtcDebtAmount, "wbtc"); | |
console.log("wbtcDebtAmount: ", wbtcDebtAmount) |
View subArray.js
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
function printSubsequences(arr, index, subarr) | |
{ | |
// Print the subsequence when reach | |
// the leaf of recursion tree | |
if (index === arr.length) | |
{ | |
// Condition to avoid printing | |
// empty subsequence | |
if (subarr.length != 0) | |
console.log(subarr); |
View getSubArraysOfSum.js
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
/* | |
References: | |
============== | |
1: HTTPS://WWW.QUORA.COM/WHAT-IS-THE-RECURSIVE-SOLUTION-FOR-FINDING-ALL-SUBSETS-OF-A-GIVEN-ARRAY | |
2: HTTPS://WWW.IDESERVE.CO.IN/LEARN/GENERATE-ALL-SUBSETS-OF-A-SET-RECURSION | |
hellow world from emacs | |
*/ |
View short_dai.js
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
await dsa.setInstance(dsa.instance.id); | |
let borrowAmount = 10000; // 10000 DAI | |
let borrowAmtInWei = dsa.tokens.fromDecimal(borrowAmount, "dai"); // borrow flash loan and swap via OasisDEX | |
let position = await dsa.compound.getPosition(); | |
let debtAmount = position.wbtc.borrow; | |
let debtAmtInWei = dsa.tokens.fromDecimal(debtAmount, "wbtc"); // borrow flash loan and swap via OasisDEX | |
let slippage = 0.5; // 0.5% slippage. |
View .zshrc
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
# Path to your oh-my-zsh installation. | |
export ZSH=/Users/leckylao/.oh-my-zsh | |
# Set name of the theme to load. | |
# Look in ~/.oh-my-zsh/themes/ | |
# Optionally, if you set this to "random", it'll load a random theme each | |
# time that oh-my-zsh is loaded. | |
# ZSH_THEME="robbyrussell" | |
# two lines |
NewerOlder