mirror of
https://github.com/tornadocash/tornado-nova
synced 2024-02-02 14:53:56 +01:00
fix: transfer from contract
This commit is contained in:
parent
5a2e0151bf
commit
99e1a769eb
@ -19,6 +19,10 @@ interface IVerifier {
|
|||||||
function verifyProof(bytes memory _proof, uint256[24] memory _input) external view returns (bool);
|
function verifyProof(bytes memory _proof, uint256[24] memory _input) external view returns (bool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface ERC20 {
|
||||||
|
function transfer(address to, uint256 value) external returns (bool);
|
||||||
|
}
|
||||||
|
|
||||||
contract TornadoPool {
|
contract TornadoPool {
|
||||||
uint256 public constant FIELD_SIZE = 21888242871839275222246405745257275088548364400416034343698204186575808495617;
|
uint256 public constant FIELD_SIZE = 21888242871839275222246405745257275088548364400416034343698204186575808495617;
|
||||||
uint256 public constant MAX_EXT_AMOUNT = 2**248 - 1;
|
uint256 public constant MAX_EXT_AMOUNT = 2**248 - 1;
|
||||||
@ -90,13 +94,15 @@ contract TornadoPool {
|
|||||||
} else if (extAmount < 0) {
|
} else if (extAmount < 0) {
|
||||||
require(msg.value == 0, "Sent ETH amount should be 0 for withdrawal");
|
require(msg.value == 0, "Sent ETH amount should be 0 for withdrawal");
|
||||||
require(_extData.recipient != address(0), "Can't withdraw to zero address");
|
require(_extData.recipient != address(0), "Can't withdraw to zero address");
|
||||||
_extData.recipient.transfer(uint256(-extAmount));
|
// _extData.recipient.transfer(uint256(-extAmount));
|
||||||
|
ERC20(0x4200000000000000000000000000000000000006).transfer(_extData.recipient, uint256(-extAmount));
|
||||||
} else {
|
} else {
|
||||||
require(msg.value == 0, "Sent ETH amount should be 0 for transaction");
|
require(msg.value == 0, "Sent ETH amount should be 0 for transaction");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_fee > 0) {
|
if (_fee > 0) {
|
||||||
_extData.relayer.transfer(_fee);
|
// _extData.relayer.transfer(_fee);
|
||||||
|
ERC20(0x4200000000000000000000000000000000000006).transfer(_extData.relayer, _fee);
|
||||||
}
|
}
|
||||||
|
|
||||||
emit NewCommitment(_outputCommitments[0], currentCommitmentIndex++, _extData.encryptedOutput1);
|
emit NewCommitment(_outputCommitments[0], currentCommitmentIndex++, _extData.encryptedOutput1);
|
||||||
|
@ -13,7 +13,7 @@ const config = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
ovm: {
|
ovm: {
|
||||||
solcVersion: '0.7.6', // Your version goes here.
|
solcVersion: '0.7.6+commit.3b061308',
|
||||||
},
|
},
|
||||||
networks: {
|
networks: {
|
||||||
// goerli: {
|
// goerli: {
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
"circuit": "./scripts/buildCircuit.sh 2 && ./scripts/buildCircuit.sh 16",
|
"circuit": "./scripts/buildCircuit.sh 2 && ./scripts/buildCircuit.sh 16",
|
||||||
"compile": "npx hardhat compile",
|
"compile": "npx hardhat compile",
|
||||||
"build": "npm run circuit && npm run compile",
|
"build": "npm run circuit && npm run compile",
|
||||||
|
"deploy": "npx hardhat run scripts/deploy.js --network optimism",
|
||||||
"download": "curl -L https://github.com/tornadocash/tornado-pool/releases/download/tmp/ptau15 --create-dirs -o artifacts/circuits/ptau15",
|
"download": "curl -L https://github.com/tornadocash/tornado-pool/releases/download/tmp/ptau15 --create-dirs -o artifacts/circuits/ptau15",
|
||||||
"test": "npx hardhat test",
|
"test": "npx hardhat test",
|
||||||
"eslint": "eslint --ext .js --ignore-path .gitignore .",
|
"eslint": "eslint --ext .js --ignore-path .gitignore .",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
const { ethers } = require('hardhat')
|
const { ethers } = require('hardhat')
|
||||||
|
|
||||||
const MERKLE_TREE_HEIGHT = 5
|
const MERKLE_TREE_HEIGHT = 32
|
||||||
const MerkleTree = require('fixed-merkle-tree')
|
const MerkleTree = require('fixed-merkle-tree')
|
||||||
const { poseidon } = require('circomlib')
|
const { poseidon } = require('circomlib')
|
||||||
const poseidonHash = (items) => ethers.BigNumber.from(poseidon(items).toString())
|
const poseidonHash = (items) => ethers.BigNumber.from(poseidon(items).toString())
|
||||||
|
Loading…
Reference in New Issue
Block a user