Skip to content

Instantly share code, notes, and snippets.

View atvanguard's full-sized avatar
🔭
everyday m hubblin'

atvanguard atvanguard

🔭
everyday m hubblin'
View GitHub Profile
/**
* @dev Mint DUSD
* @param in_amounts Exact in_amounts in the same order as required by the curve pool
* @param min_dusd_amount Minimum DUSD to mint, used for capping slippage
*/
function mint(
uint[] calldata in_amounts,
uint min_dusd_amount
) external returns (uint dusd_amount) {
- pull in_amounts
pragma solidity ^0.5.12;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./curve/ICurve.sol";
import {DUSD} from "./DUSD.sol";
contract Core {
uint constant MAX = 2 ** 256 - 1;
uint constant N_COINS = 4; // sUSD pool
/* Add maticjs Library as a dep in your project
This library is still WIP, so locking the lib on a commit id for now
npm i --save atvanguard/matic.js#ff738ac9addca5ead3474f238f42b921ebfe2ffd
*/
import Matic from 'maticjs'
async function initializeMaticClient(contracts) {
const options = {
[ Result {
open: false,
executed: false,
startDate: '1548287965',
snapshotBlock: '7116241',
supportRequired: '500000000000000000',
minAcceptQuorum: '0',
yea: '3014943555192266542494264',
nay: '89990168634229999999839',
votingPower: '39609523809523809540000000',
d8f608c51fbdd8bc53ffdf557021c33c46c3c9910ac392e5fdca1c7c3fec109688bf3ead77e10c6c35081d2c5ea5aa8cc5a4b42358068fcda72d2f39fdf164af
pragma solidity 0.5.10;
import { IMarket } from "./augur/reporting/IMarket.sol";
import { IAccountManager } from "./IAccountManager.sol";
contract AccountManager is IAccountManager {
struct Balance {
uint256 priority;
uint256 balance;
[parity]
chain = "spec.json"
base_path = "/tmp/parity"
keys_path = "./keys"
db_path = "./info/chains"
[network]
port = 30301
reserved_only = false
reserved_peers = "./enodes.txt"
[rpc]
{
"name": "Matic",
"engine": {
"authorityRound": {
"params": {
"stepDuration": "5",
"validators": {
"list": ["0x9fB29AAc15b9A4B7F17c3385939b007540f4d791"]
}
}
const crypto = require('crypto');
const BN = require('bn.js');
function getSecretZokratesParams(concat) {
return [concat.slice(0, 32), concat.slice(32, 64), concat.slice(64, 96), concat.slice(96)]//.map(e => e.toString(10))
}
function getPublicZokratesParams(hexPayload) {
// console.log('getPublicZokratesParams - hexPayload', hexPayload)
const buf = Buffer.from(hexPayload, 'hex');
import "LIBSNARK/sha256packed"
// https://zokrates.github.io/sha256example.html#computing-a-hash-using-zokrates
// A field value can only hold 254 bits due to the size of the underlying prime field used by zokrates. Therefore, 256 bit values need to be passed as 2 params of 128 bit values.
// https://zokrates.github.io/concepts/stdlib.html?highlight=sha256#sha256packed
// At the time of writing sha256packed takes 4 field elements as inputs, unpacks each of them to 128 bits (big endian), concatenates them and applies sha256. It then returns two field elements, each representing 128 bits of the result.
// Public inputs
// onh0 + onh1: Hash of the note (secret note)