Skip to content

Commit

Permalink
Update contract type for IAnchor class (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
nepoche authored May 5, 2022
1 parent c27c486 commit 75081c4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
9 changes: 4 additions & 5 deletions contracts/anchors/FixedDepositAnchor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ contract FixedDepositAnchor is AnchorBase, IFixedDepositAnchor {
*/
function deposit(bytes32 _commitment) override public payable {
require(msg.value == 0, "ETH value is supposed to be 0 for ERC20 instance");
uint32 insertedIndex = insert(_commitment);
IMintableERC20(token).transferFrom(msg.sender, address(this), denomination);
uint32 insertedIndex = insert(_commitment);
emit Deposit(msg.sender, insertedIndex, _commitment, block.timestamp);
}

Expand Down Expand Up @@ -139,8 +139,7 @@ contract FixedDepositAnchor is AnchorBase, IFixedDepositAnchor {
);
} else {
require(!commitments[_extData._refreshCommitment], "The commitment has been submitted");
uint32 insertedIndex = _insert(_extData._refreshCommitment);
commitments[_extData._refreshCommitment] = true;
uint32 insertedIndex = insert(_extData._refreshCommitment);
emit Refresh(
_extData._refreshCommitment,
_proof._nullifierHash,
Expand Down Expand Up @@ -250,8 +249,8 @@ contract FixedDepositAnchor is AnchorBase, IFixedDepositAnchor {
address(this)
);
// insert a new commitment to the tree
uint32 insertedIndex = _insert(_commitment);
commitments[_commitment] = true;
uint32 insertedIndex = insert(_commitment);

// emit the deposit event
emit Deposit(msg.sender, insertedIndex, _commitment, block.timestamp);
}
Expand Down
1 change: 1 addition & 0 deletions packages/interfaces/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"compile": "tsc -p tsconfig.build.json"
},
"dependencies": {
"@webb-tools/contracts": "0.1.8",
"@webb-tools/utils": "^0.1.7"
},
"publishConfig": {
Expand Down
3 changes: 2 additions & 1 deletion packages/interfaces/src/IAnchor.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { IAnchorDeposit, IAnchorDepositInfo } from './anchor';
import { AnchorBase } from '@webb-tools/contracts';
import { IMerkleProofData } from './vanchor';
import { Utxo } from "@webb-tools/utils";
import { BigNumberish, ethers } from 'ethers';

export interface IAnchor {
signer: ethers.Signer;
contract: ethers.Contract;
contract: AnchorBase;
tree: any;
// hex string of the connected root
latestSyncedBlock: number;
Expand Down

0 comments on commit 75081c4

Please sign in to comment.