Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed build/ptau/pot12_final.ptau
Binary file not shown.
2 changes: 0 additions & 2 deletions circuits/bridgePoseidon/withdraw.circom
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
include "../../node_modules/circomlib/circuits/bitify.circom";
include "../../node_modules/circomlib/circuits/pedersen.circom";
include "manyMerkleTree.circom";

// computes Poseidon(chainID, nullifier, secret)
Expand Down
1 change: 0 additions & 1 deletion contracts/Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import "./utils/Pausable.sol";
import "./utils/SafeMath.sol";
import "./utils/SafeCast.sol";
import "./interfaces/IDepositExecute.sol";
import "./interfaces/IUpdateExecute.sol";
import "./interfaces/IExecutor.sol";
import "./interfaces/IERCHandler.sol";

Expand Down
89 changes: 0 additions & 89 deletions contracts/anchors/LinkableAnchor.sol

This file was deleted.

53 changes: 0 additions & 53 deletions contracts/anchors/LinkableERC20Anchor.sol

This file was deleted.

47 changes: 47 additions & 0 deletions contracts/anchors/bridged/AnchorFactoryPoseidon.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* Copyright 2021 Webb Technologies
* SPDX-License-Identifier: LGPL-3.0-only
*/

pragma solidity ^0.8.0;

import "./LinkableERC20AnchorPoseidon2.sol";

contract AnchorFactoryPoseidon {
function createAnchor2(
IVerifier _verifier,
IPoseidonT3 _hasher,
uint256 _denomination,
uint32 _merkleTreeHeight,
uint32 _chainID,
IERC20 _token
) external {
new LinkableERC20AnchorPoseidon2(
_verifier,
_hasher,
_denomination,
_merkleTreeHeight,
_chainID,
_token
);
}

function create2Anchor2(
bytes32 _salt,
IVerifier _verifier,
IPoseidonT3 _hasher,
uint256 _denomination,
uint32 _merkleTreeHeight,
uint32 _chainID,
IERC20 _token
) external {
new LinkableERC20AnchorPoseidon2{salt: _salt}(
_verifier,
_hasher,
_denomination,
_merkleTreeHeight,
_chainID,
_token
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,6 @@ abstract contract AnchorPoseidon2 is MerkleTreePoseidon, ReentrancyGuard {
}
}

function hasEdge(uint8 _chainID) public view returns (bool) {
return edgeExistsForChain[_chainID];
}

modifier onlyAdmin() {
require(msg.sender == admin, 'sender is not the admin');
_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,36 @@
pragma solidity ^0.8.0;

import "./AnchorPoseidon2.sol";
import "../../interfaces/ILinkableAnchor.sol";

abstract contract LinkableAnchorPoseidon2 is AnchorPoseidon2 {
abstract contract LinkableAnchorPoseidon2 is AnchorPoseidon2, ILinkableAnchor {
constructor(
IVerifier _verifier,
IPoseidonT3 _hasher,
uint256 _denomination,
uint32 _merkleTreeHeight,
uint32 _maxRoots
) AnchorPoseidon2(_verifier, _hasher, _denomination, _merkleTreeHeight, _maxRoots) {
uint32 _chainID
) AnchorPoseidon2(_verifier, _hasher, _denomination, _merkleTreeHeight, _chainID) {
// set the sender as admin & bridge & handler address
// TODO: Properly set addresses and permissions
bridge = msg.sender;
admin = msg.sender;
handler = msg.sender;
}

function setHandler(address _handler) onlyBridge external {
function setHandler(address _handler) onlyBridge override external {
handler = _handler;
}

function setBridge(address _bridge) onlyAdmin external {
function setBridge(address _bridge) onlyAdmin override external {
bridge = _bridge;
}

function recordHistory() external {
function hasEdge(uint8 _chainID) override external view returns (bool) {
return edgeExistsForChain[_chainID];
}

function recordHistory() override external {
// add a new historical record by snapshotting the Anchor's current neighbors
bytes32[1] memory history = getLatestNeighborRoots();
rootHistory[latestHistoryIndex] = history;
Expand All @@ -44,7 +49,7 @@ abstract contract LinkableAnchorPoseidon2 is AnchorPoseidon2 {
bytes32 resourceID,
bytes32 root,
uint256 height
) onlyHandler external payable nonReentrant {
) onlyHandler override external payable nonReentrant {
require(edgeList.length < 1, "This Anchor is at capacity");
edgeExistsForChain[sourceChainID] = true;
uint index = edgeList.length;
Expand All @@ -68,7 +73,7 @@ abstract contract LinkableAnchorPoseidon2 is AnchorPoseidon2 {
bytes32 resourceID,
bytes32 root,
uint256 height
) onlyHandler external payable nonReentrant {
) onlyHandler override external payable nonReentrant {
require(edgeExistsForChain[sourceChainID], "Chain must be integrated from the bridge before updates");
require(edgeList[edgeIndex[resourceID]].height < height, "New height must be greater");
uint index = edgeIndex[resourceID];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ contract LinkableERC20AnchorPoseidon2 is LinkableAnchorPoseidon2 {
IPoseidonT3 _hasher,
uint256 _denomination,
uint32 _merkleTreeHeight,
uint32 _maxRoots,
uint32 _chainID,
IERC20 _token
) LinkableAnchorPoseidon2(_verifier, _hasher, _denomination, _merkleTreeHeight, _maxRoots) {
) LinkableAnchorPoseidon2(_verifier, _hasher, _denomination, _merkleTreeHeight, _chainID) {
token = _token;
}

Expand Down
14 changes: 0 additions & 14 deletions contracts/anchors/poseidon/AnchorFactoryPoseidon.sol

This file was deleted.

Loading