Skip to content

Instantly share code, notes, and snippets.

0x084f529aba9d721273a92a2f1346908ca94fe6db1d89804266697d7935dc797d

@talbaneth
talbaneth / flash-killer-keeper review.txt
Last active March 29, 2022 07:05
flash-killer-keeper review
const fs = require('fs');
const fetch = require('node-fetch'); // TB - unused?
const ethers = require("ethers");
// configuration
const WS_RPC = 'http://127.0.0.1:8545/';
// const WS_RPC = 'ws://192.168.1.111:8546/';
const CHAINLOG = "0xdA0Ab1e0017DEbCd72Be8599041a2aa3bA7e740F";
const MAX_GAS_LIMIT = ethers.utils.parseUnits('10000000', 'wei');
const GAS_BUMP = ethers.utils.parseUnits('200000', 'wei');
// hevm: flattened sources of src/DssSpell.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity =0.6.12 >=0.6.12 <0.7.0;
pragma experimental ABIEncoderV2;
////// lib/dss-exec-lib/src/CollateralOpts.sol
/* pragma solidity ^0.6.12; */
struct CollateralOpts {
bytes32 ilk;
Need to check that this calculation does not overflow or lose precision:
uint160 sqrtPriceX96 = sqrt((p0 * 10^UNITS_1 * 2^96) / (p1 * 10^UNITS_0)) * 2^48
Notes:
* p0 and p1 are uint256 wads.
* Assuming that the sqrt function does not have overflow/precision problems as it is used in univ2 oracle and tested through unit tests.
1. For numerator expression to not overflow this needs to hold:
p0 * 10^UNITS_1 * 2^96 < 2^256 // 2^96 < 10^29, 2^256 > 10^77 =>
p0 * 10^UNITS_1 * 10^29 < 10^77 // p0 = token0_usd_price * 10^18, UNITS_1 <= 20
[submodule "lib/ds-test"]
path = lib/ds-test
url = https://github.com/dapphub/ds-test
[submodule "lib/dss-gem-joins"]
path = lib/dss-gem-joins
url = https://github.com/talbaneth/dss-gem-joins
branch = join-managed
[submodule "lib/dss-crop-join"]
path = lib/dss-crop-join
url = https://github.com/makerdao/dss-crop-join
@talbaneth
talbaneth / libra_atomic_swaps.txt
Last active July 23, 2019 05:53
libra atomic swaps
// NOTE: this module is based on the logic of earmarked_libra.mvir
// A module for allocating a coin for atomic swap
module AtomicSwapCoin {
import 0x0.LibraCoin;
import 0x0.Hash;
// A wrapper containing a Libra coin and the address of the recipient the
// coin is allocated for.
resource T {
npx truffle test
Using network 'development'.
Compiling ./contracts/ERC20Interface.sol...
Contract: ConversionRates
✓ should init globals
✓ should test bytes14. (368ms)
✓ should init ConversionRates Inst and set general parameters. (3392ms)
npx truffle test
Using network 'development'.
Compiling ./contracts/ERC20Interface.sol...
Contract: ConversionRates
✓ should init globals
✓ should test bytes14. (368ms)
✓ should init ConversionRates Inst and set general parameters. (3392ms)
added 1409 packages in 43.778s
+ npx truffle compile
Compiling ./contracts/ConversionRates.sol...
Compiling ./contracts/ConversionRatesInterface.sol...
Compiling ./contracts/ERC20Interface.sol...
Compiling ./contracts/ExpectedRate.sol...
Compiling ./contracts/ExpectedRateInterface.sol...
Compiling ./contracts/FeeBurner.sol...
Compiling ./contracts/FeeBurnerInterface.sol...
Compiling ./contracts/KyberNetwork.sol...
+ npx truffle test
+ ganache-cli -d --defaultBalanceEther 500000000
Using network 'development'.
Compiling ./contracts/ERC20Interface.sol...
Contract: ConversionRates
✓ should init globals
✓ should test bytes14. (359ms)