mirror of
https://github.com/tornadocash/tornado-nova
synced 2024-02-02 14:53:56 +01:00
more docs
This commit is contained in:
parent
039721ed7b
commit
45a2c01e33
@ -19,6 +19,9 @@ import { CrossChainGuard } from "./bridge/CrossChainGuard.sol";
|
|||||||
import { IVerifier } from "./interfaces/IVerifier.sol";
|
import { IVerifier } from "./interfaces/IVerifier.sol";
|
||||||
import "./MerkleTreeWithHistory.sol";
|
import "./MerkleTreeWithHistory.sol";
|
||||||
|
|
||||||
|
/** @dev This contract(pool) allows deposit of an arbitrary amount to it, shielded transfer to another registered user inside the pool
|
||||||
|
* and withdrawal from the pool. Project utilizes UTXO model to handle users' funds.
|
||||||
|
*/
|
||||||
contract TornadoPool is MerkleTreeWithHistory, IERC20Receiver, ReentrancyGuard, CrossChainGuard {
|
contract TornadoPool is MerkleTreeWithHistory, IERC20Receiver, ReentrancyGuard, CrossChainGuard {
|
||||||
int256 public constant MAX_EXT_AMOUNT = 2**248;
|
int256 public constant MAX_EXT_AMOUNT = 2**248;
|
||||||
uint256 public constant MAX_FEE = 2**248;
|
uint256 public constant MAX_FEE = 2**248;
|
||||||
@ -71,6 +74,13 @@ contract TornadoPool is MerkleTreeWithHistory, IERC20Receiver, ReentrancyGuard,
|
|||||||
@dev The constructor
|
@dev The constructor
|
||||||
@param _verifier2 the address of SNARK verifier for 2 inputs
|
@param _verifier2 the address of SNARK verifier for 2 inputs
|
||||||
@param _verifier16 the address of SNARK verifier for 16 inputs
|
@param _verifier16 the address of SNARK verifier for 16 inputs
|
||||||
|
@param _levels hight of the commitments merkle tree
|
||||||
|
@param _hasher hasher address for the merkle tree
|
||||||
|
@param _token token address for the pool
|
||||||
|
@param _omniBridge omniBridge address for specified token
|
||||||
|
@param _l1Unwrapper address of the L1Helper
|
||||||
|
@param _governance owner address
|
||||||
|
@param _l1ChainId chain id of L1
|
||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
IVerifier _verifier2,
|
IVerifier _verifier2,
|
||||||
@ -98,6 +108,8 @@ contract TornadoPool is MerkleTreeWithHistory, IERC20Receiver, ReentrancyGuard,
|
|||||||
super._initialize();
|
super._initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @dev Main function that allows deposits, transfers and withdrawal.
|
||||||
|
*/
|
||||||
function transact(Proof memory _args, ExtData memory _extData) public {
|
function transact(Proof memory _args, ExtData memory _extData) public {
|
||||||
if (_extData.extAmount > 0) {
|
if (_extData.extAmount > 0) {
|
||||||
// for deposits from L2
|
// for deposits from L2
|
||||||
|
@ -3,6 +3,9 @@ pragma solidity ^0.7.0;
|
|||||||
|
|
||||||
import { IAMB } from "../interfaces/IBridge.sol";
|
import { IAMB } from "../interfaces/IBridge.sol";
|
||||||
|
|
||||||
|
/** @dev Special cross chain guard that can authorize caller as owner of this contract according to XDAI AMB bridge protocol.
|
||||||
|
* more info here https://docs.tokenbridge.net/amb-bridge/development-of-a-cross-chain-application/how-to-develop-xchain-apps-by-amb#receive-a-method-call-from-the-amb-bridge
|
||||||
|
*/
|
||||||
contract CrossChainGuard {
|
contract CrossChainGuard {
|
||||||
IAMB public immutable ambBridge;
|
IAMB public immutable ambBridge;
|
||||||
bytes32 public immutable ownerChainId;
|
bytes32 public immutable ownerChainId;
|
||||||
|
@ -1,4 +1,15 @@
|
|||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
// https://tornado.cash
|
||||||
|
/*
|
||||||
|
* d888888P dP a88888b. dP
|
||||||
|
* 88 88 d8' `88 88
|
||||||
|
* 88 .d8888b. 88d888b. 88d888b. .d8888b. .d888b88 .d8888b. 88 .d8888b. .d8888b. 88d888b.
|
||||||
|
* 88 88' `88 88' `88 88' `88 88' `88 88' `88 88' `88 88 88' `88 Y8ooooo. 88' `88
|
||||||
|
* 88 88. .88 88 88 88 88. .88 88. .88 88. .88 dP Y8. .88 88. .88 88 88 88
|
||||||
|
* dP `88888P' dP dP dP `88888P8 `88888P8 `88888P' 88 Y88888P' `88888P8 `88888P' dP dP
|
||||||
|
* ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
|
||||||
|
*/
|
||||||
|
|
||||||
pragma solidity ^0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
pragma abicoder v2;
|
pragma abicoder v2;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user