This file contains hidden or 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
const Web3 = require('web3'); | |
const BigNumber = require('bignumber.js'); | |
const ERC20ABI = require('./abis/ERC20.json'); | |
const RPC_URL = 'https://evm-cronos.crypto.org'; | |
const calcRemoveLiquidityAmounts = async (lpAmount, tokenAAddress, tokenBAddress, lpAddress) => { | |
const slippage = 0.001; // 0.1% slippage | |
const web3 = new Web3(RPC_URL); | |
const tokenA = new web3.eth.Contract(ERC20ABI, tokenAAddress); | |
const tokenB = new web3.eth.Contract(ERC20ABI, tokenBAddress); |
This file contains hidden or 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
getFormValidationErrors() { | |
Object.keys(this.tripRequestForm.controls).forEach(key => { | |
const controlErrors: ValidationErrors = this.tripRequestForm.get(key).errors; | |
if (controlErrors != null) { | |
Object.keys(controlErrors).forEach(keyError => { | |
console.log('Key control: ' + key + ', keyError: ' + keyError + ', err value: ', controlErrors[keyError]); | |
}); | |
} | |
}); |
This file contains hidden or 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
var Promise = require('bluebird'); | |
var mongoose = require('mongoose'); | |
console.log('mongoose version:', mongoose.version); | |
mongoose.Promise = Promise; | |
mongoose.set('debug', true); | |
var ParentSchema = new mongoose.Schema({ | |
name: {type: String}, | |
children: [{name: String}] |