Commits (2)
{
"depositPrivateKey": "0d126a183d025c71257ce2d8ce7e4e0a0a2c7800f0e381ce5088fc5f0be5ae23",
"withdrawPrivateKey": "242984a391b1941cebb711786c5e0f09f50f17ad61e3358ee56526892915f059",
"relayerPrivateKey": "a12e0c4ce6fa2b661da7e922568633eb8ddf647fb312ba9c98b1936b00071b9f",
"fee": 1,
"depositPrivateKey": "69c31041bc05289562bb674d1c955ea6ff6bb5334b8eab51c11aaa606e94f5c8",
"withdrawPrivateKey": "69c31041bc05289562bb674d1c955ea6ff6bb5334b8eab51c11aaa606e94f5c8",
"relayerPrivateKey": "69c31041bc05289562bb674d1c955ea6ff6bb5334b8eab51c11aaa606e94f5c8",
"fee": "100000000000000000",
"rpc": "https://goerli.infura.io/v3/a4190df0a43c4d639bbb61be96ffce3c",
"denomination": 1000,
"denomination": "10000000000000000000",
"xft": "0x31b0A3e4bF7f55069Faa13b2d8EEAAF96F3ee5b7",
"ausd": "0x043337B12f4E8E29FE7c770ec6cf75AA46ee0BC8",
"mixer": "0xec7f587Ab88E9Dae28d07f95C53d685e89BAa7eA",
"faucet": "0x3b086cbf017135C01189dD3Bd74e2d34DC4a7cDB",
"refund": 0,
"mixer": "0x6eF21d2e4fE198323F35d8273eDe303d7d46a362",
"faucet": "0x36F60583E7f9aB1Fca10de213770A62CDDD40b8f",
"refund": "0",
"height": 20,
"gasPrice": 5,
"gasLimit": 300000,
"gasLimit": 3000000,
"note": {}
}
\ No newline at end of file
......@@ -23,14 +23,29 @@
"type": "uint32"
},
{
"internalType": "contract XFTMock",
"internalType": "contract ElasticIERC20",
"name": "_token",
"type": "address"
},
{
"internalType": "contract aUSDMock",
"internalType": "contract ElasticIERC20",
"name": "_aUSD",
"type": "address"
},
{
"internalType": "address",
"name": "_tokenPool",
"type": "address"
},
{
"internalType": "address",
"name": "_usdPool",
"type": "address"
},
{
"internalType": "uint32",
"name": "_interval",
"type": "uint32"
}
],
"stateMutability": "nonpayable",
......@@ -61,6 +76,51 @@
"name": "Deposit",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "Paused",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "Unpaused",
"type": "event"
},
{
"anonymous": false,
"inputs": [
......@@ -125,7 +185,21 @@
"name": "USD",
"outputs": [
{
"internalType": "contract aUSDMock",
"internalType": "contract ElasticIERC20",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [],
"name": "USDPool",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
......@@ -322,6 +396,20 @@
"type": "function",
"constant": true
},
{
"inputs": [],
"name": "interval",
"outputs": [
{
"internalType": "uint32",
"name": "",
"type": "uint32"
}
],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [
{
......@@ -430,6 +518,55 @@
"type": "function",
"constant": true
},
{
"inputs": [],
"name": "oracleActive",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [],
"name": "paused",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
......@@ -455,7 +592,21 @@
"name": "token",
"outputs": [
{
"internalType": "contract XFTMock",
"internalType": "contract ElasticIERC20",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [],
"name": "tokenPool",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
......@@ -478,6 +629,19 @@
"type": "function",
"constant": true
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "verifier",
......@@ -556,32 +720,43 @@
"type": "function",
"constant": true
},
{
"inputs": [],
"name": "pause",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "price",
"type": "uint256"
"internalType": "uint32",
"name": "_interval",
"type": "uint32"
}
],
"name": "_setPrice",
"name": "setInterval",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "getPrice",
"outputs": [
"inputs": [
{
"internalType": "uint256",
"name": "",
"name": "_amount",
"type": "uint256"
},
{
"internalType": "address",
"name": "_recipient",
"type": "address"
}
],
"stateMutability": "view",
"type": "function",
"constant": true
"name": "simpleShift",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
......
......@@ -11,7 +11,7 @@ const bigInt = snarkjs.bigInt
const MerkleTree = require('fixed-merkle-tree')
const crypto = require('crypto')
const circomlib = require('circomlib')
const { toBN, keccak256 } = require('web3-utils')
const { toBN, keccak256, fromWei } = require('web3-utils')
const Web3 = require('web3')
let web3, mixer, circuit, proving_key, groth16, sender, xft, ausd, faucet, tree, withdrawAccount,
......@@ -20,9 +20,9 @@ let web3, mixer, circuit, proving_key, groth16, sender, xft, ausd, faucet, tree,
error;
const levels = config.height
const tokenDenomination = config.denomination
const fee = config.fee
const refund = config.refund
const tokenDenomination = toBN(config.denomination)
const fee = toBN(config.fee)
const refund = toBN(config.refund)
const rbigint = (nbytes) => snarkjs.bigInt.leBuff2int(crypto.randomBytes(nbytes))
const pedersenHash = (data) => circomlib.babyJub.unpackPoint(circomlib.pedersenHash.hash(data))[0]
......@@ -87,6 +87,14 @@ const mintTestTokens = async () => {
error = "Already have some XFT"
}
const simpleShift = async () => {
if (ausdBalanceW === 0) {
error = "No aUSD in withdrawal account"
} else {
await mixer.methods.simpleShift(ausdBalanceW, withdrawAccount.address).send({ from: withdrawAccount.address, gasLimit: config.gasLimit})
}
}
const depositToMixer = async () => {
if (depositObject) {
error = "Already deposited";
......@@ -180,9 +188,9 @@ const mainMenu = async () => {
YP YP YP YP YP YP VP V8P \`Y88P' VP V8P \`Y88P' Y88888P Y888888P
Anonymity Set Size: ${anonSetSize.length}
Deposit Account - XFT Balance: ${xftBalanceD} | aUSD Balance: ${ausdBalanceD}
Withdraw Account - XFT Balance: ${xftBalanceW} | aUSD Balance: ${ausdBalanceW}
Relayer Account - XFT Balance: ${xftBalanceR} | aUSD Balance: ${ausdBalanceR}
Deposit Account - XFT Balance: ${fromWei(xftBalanceD)} | aUSD Balance: ${fromWei(ausdBalanceD)}
Withdraw Account - XFT Balance: ${fromWei(xftBalanceW)} | aUSD Balance: ${fromWei(ausdBalanceW)}
Relayer Account - XFT Balance: ${fromWei(xftBalanceR)} | aUSD Balance: ${fromWei(ausdBalanceR)}
${error || ""}
${Object.keys(config.note).length > 0 ? "Deposit Note Found" : ""}
......@@ -202,12 +210,17 @@ const mainMenu = async () => {
{
value: 'd',
name: "\tBURN XFT & CONVERT TO AUSD",
short: "\n\tMaking a deposit"
short: "\n\tMaking a Deposit"
},
{
value: 'w',
name: "\tMINT AUSD",
short: "\n\tMaking a withdrawal"
short: "\n\tMaking a Withdrawal"
},
{
value: 's',
name: "\tSIMPLE SHIFT AUSD TO XFT",
short: "\n\tPerforming a Simple Shift"
},
{
value: 'exit',
......@@ -276,6 +289,7 @@ const commands = {
'm': mintTestTokens,
'd': depositToMixer,
'w': withdrawFromMixer,
's': simpleShift,
'rpc': editConfig,
'depositPrivateKey': editConfig,
'withdrawPrivateKey': editConfig,
......