Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Nov 9, 2024
1 parent 83eee34 commit c7e984b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,34 +114,13 @@ contract TokenBridge {
// Read the token address from storage
let token_address = storage.token.read_private();

// Prepare the partial note for the minted tokens
let note_hiding_point_slot =
Token::at(token_address).prepare_transfer_to_private(recipient).call(&mut context);

// We enqueue a public call in which we finalize the claim
// We pass the token address as an argument in order to not have to read it from public storage again.
TokenBridge::at(context.this_address())
._finalize_private_claim(token_address, amount, note_hiding_point_slot)
.enqueue(&mut context);
// At last we mint the tokens
// docs:start:call_mint_on_token
Token::at(token_address).mint_to_private(recipient, amount).call(&mut context);
// docs:end:call_mint_on_token
}
// docs:end:claim_private

#[public]
#[internal]
fn _finalize_private_claim(
token_address: AztecAddress,
amount: Field,
note_hiding_point_slot: Field,
) {
let token = Token::at(token_address);

// Mint the amount to this contract
token.mint_public(context.this_address(), amount).call(&mut context);

// Transfer the publicly minted tokens to the partial note
token.finalize_transfer_to_private(amount, note_hiding_point_slot).call(&mut context);
}

// docs:start:exit_to_l1_private
// Burns the appropriate amount of tokens and creates a L2 to L1 withdraw message privately
// Requires `msg.sender` (caller of the method) to give approval to the bridge to burn tokens on their behalf using witness signatures
Expand Down
8 changes: 4 additions & 4 deletions yarn-project/protocol-contracts/src/protocol_contract_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ export const ProtocolContractAddress: Record<ProtocolContractName, AztecAddress>

export const ProtocolContractLeaf = {
AuthRegistry: Fr.fromString('0x295f52c40413b660d817ceea60d07154322a035d28d18927b2ca84e8ec3b2115'),
ContractInstanceDeployer: Fr.fromString('0x01314b6c482a9d8f5418cd0d43c17a1c5899ae7c2e1d2f82817baaf3f3b45bd9'),
ContractInstanceDeployer: Fr.fromString('0x00113ad28d270a493266484d733f73a56b98c74b4e2cdf9fc040b5d3a6560f2d'),
ContractClassRegisterer: Fr.fromString('0x1d591819cccc4031cc18a7865321c54f6344ae42a205782874d1f72648df2034'),
MultiCallEntrypoint: Fr.fromString('0x20a2e7e882045d27b3aa9e36188b8e45483b3c11652d4a46406699e5eb4efa9b'),
FeeJuice: Fr.fromString('0x14c62d13cca830462ea77bb787878cca3fb8fbb44ffe4d1662c5ffdf98889d5b'),
Router: Fr.fromString('0x05fa1b40b9addbd853af7577676ad31b8b4472eb15c0ac30e784b65b66c40172'),
FeeJuice: Fr.fromString('0x2ed38c200a958d2364c9a8c6f7475cb53e75f602bb7a873b81668c5e431baeb7'),
Router: Fr.fromString('0x22ec69dd15cc4f9d7272fa362aa86212797ff2c73f33975f78f9d0289322d401'),
};

export const protocolContractTreeRoot = Fr.fromString(
'0x071b3ac4cc5d42228920bcbba6674d93eb77694a085ed413806fdfcf8a50b0b0',
'0x2ba7b6e2fca56bb4abd15d3ef75ff0fb84c9c41588f9d0947068051297d59b67',
);

0 comments on commit c7e984b

Please sign in to comment.