more docs

This commit is contained in:
Alexey 2021-10-26 13:10:30 +03:00
parent 039721ed7b
commit 45a2c01e33
No known key found for this signature in database
GPG Key ID: C77958099D784E76
3 changed files with 26 additions and 0 deletions

View File

@ -19,6 +19,9 @@ import { CrossChainGuard } from "./bridge/CrossChainGuard.sol";
import { IVerifier } from "./interfaces/IVerifier.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 {
int256 public constant MAX_EXT_AMOUNT = 2**248;
uint256 public constant MAX_FEE = 2**248;
@ -71,6 +74,13 @@ contract TornadoPool is MerkleTreeWithHistory, IERC20Receiver, ReentrancyGuard,
@dev The constructor
@param _verifier2 the address of SNARK verifier for 2 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(
IVerifier _verifier2,
@ -98,6 +108,8 @@ contract TornadoPool is MerkleTreeWithHistory, IERC20Receiver, ReentrancyGuard,
super._initialize();
}
/** @dev Main function that allows deposits, transfers and withdrawal.
*/
function transact(Proof memory _args, ExtData memory _extData) public {
if (_extData.extAmount > 0) {
// for deposits from L2

View File

@ -3,6 +3,9 @@ pragma solidity ^0.7.0;
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 {
IAMB public immutable ambBridge;
bytes32 public immutable ownerChainId;

View File

@ -1,4 +1,15 @@
// 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 abicoder v2;