Skip to content

Commit 540fc11

Browse files
author
sklppy88
committed
fixing build
1 parent 0898efc commit 540fc11

File tree

4 files changed

+23
-18
lines changed

4 files changed

+23
-18
lines changed

noir-projects/noir-contracts/contracts/token_bridge_contract/src/main.nr

+7-7
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ contract TokenBridge {
1717
// Storage structure, containing all storage, and specifying what slots they use.
1818
#[aztec(storage)]
1919
struct Storage {
20-
token: PublicMutable<AztecAddress>,
20+
token: SharedImmutable<AztecAddress>,
2121
portal_address: SharedImmutable<EthAddress>,
2222
}
2323

2424
// Constructs the contract.
2525
#[aztec(public)]
2626
#[aztec(initializer)]
2727
fn constructor(token: AztecAddress, portal_address: EthAddress) {
28-
storage.token.write(token);
28+
storage.token.initialize(token);
2929
storage.portal_address.initialize(portal_address);
3030
}
3131
// docs:end:token_bridge_storage_and_constructor
@@ -55,7 +55,7 @@ contract TokenBridge {
5555
);
5656

5757
// Mint tokens
58-
Token::at(storage.token.read()).mint_public(to, amount).call(&mut context);
58+
Token::at(storage.token.read_public()).mint_public(to, amount).call(&mut context);
5959
}
6060
// docs:end:claim_public
6161

@@ -74,7 +74,7 @@ contract TokenBridge {
7474
context.message_portal(storage.portal_address.read_public(), content);
7575

7676
// Burn tokens
77-
Token::at(storage.token.read()).burn_public(context.msg_sender(), amount, nonce).call(&mut context);
77+
Token::at(storage.token.read_public()).burn_public(context.msg_sender(), amount, nonce).call(&mut context);
7878
}
7979
// docs:end:exit_to_l1_public
8080
// docs:start:claim_private
@@ -147,7 +147,7 @@ contract TokenBridge {
147147
#[aztec(public)]
148148
#[aztec(view)]
149149
fn get_token() -> AztecAddress {
150-
storage.token.read()
150+
storage.token.read_public()
151151
}
152152
// docs:end:get_token
153153

@@ -158,15 +158,15 @@ contract TokenBridge {
158158
#[aztec(public)]
159159
#[aztec(internal)]
160160
fn _call_mint_on_token(amount: Field, secret_hash: Field) {
161-
Token::at(storage.token.read()).mint_private(amount, secret_hash).call(&mut context);
161+
Token::at(storage.token.read_public()).mint_private(amount, secret_hash).call(&mut context);
162162
}
163163
// docs:end:call_mint_on_token
164164

165165
// docs:start:assert_token_is_same
166166
#[aztec(public)]
167167
#[aztec(internal)]
168168
fn _assert_token_is_same(token: AztecAddress) {
169-
assert(storage.token.read().eq(token), "Token address is not the same as seen in storage");
169+
assert(storage.token.read_public().eq(token), "Token address is not the same as seen in storage");
170170
}
171171
// docs:end:assert_token_is_same
172172
}

yarn-project/cli-wallet/src/cmds/bridge_fee_juice.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,23 @@ export async function bridgeL1FeeJuice(
2525
const client = await createCompatibleClient(rpcUrl, debugLogger);
2626

2727
// Setup portal manager
28-
const portal = await FeeJuicePortalManager.create(client, publicClient, walletClient, debugLogger);
29-
const { secret } = await portal.prepareTokensOnL1(amount, amount, recipient, mint);
28+
const portal = await FeeJuicePortalManager.new(client, publicClient, walletClient, debugLogger);
29+
const { claimAmount, claimSecret } = await portal.bridgeTokensPublic(recipient, amount, mint);
3030

3131
if (json) {
3232
const out = {
33-
claimAmount: amount,
34-
claimSecret: secret,
33+
claimAmount,
34+
claimSecret,
3535
};
3636
log(prettyPrintJSON(out));
3737
} else {
3838
if (mint) {
39-
log(`Minted ${amount} fee juice on L1 and pushed to L2 portal`);
39+
log(`Minted ${claimAmount} fee juice on L1 and pushed to L2 portal`);
4040
} else {
41-
log(`Bridged ${amount} fee juice to L2 portal`);
41+
log(`Bridged ${claimAmount} fee juice to L2 portal`);
4242
}
43-
log(`claimAmount=${amount},claimSecret=${secret}\n`);
43+
log(`claimAmount=${claimAmount},claimSecret=${claimSecret}\n`);
4444
log(`Note: You need to wait for two L2 blocks before pulling them from the L2 side`);
4545
}
46-
return secret;
46+
return claimSecret;
4747
}

yarn-project/cli/src/cmds/devnet/bootstrap_network.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -231,15 +231,15 @@ async function fundFPC(
231231

232232
const feeJuiceContract = await FeeJuiceContract.at(feeJuice, wallet);
233233

234-
const feeJuicePortal = await FeeJuicePortalManager.create(
234+
const feeJuicePortal = await FeeJuicePortalManager.new(
235235
wallet,
236236
l1Clients.publicClient,
237237
l1Clients.walletClient,
238238
debugLog,
239239
);
240240

241241
const amount = 10n ** 21n;
242-
const { secret } = await feeJuicePortal.prepareTokensOnL1(amount, amount, fpcAddress, true);
242+
const { claimAmount, claimSecret } = await feeJuicePortal.bridgeTokensPublic(fpcAddress, amount, true);
243243

244244
const counter = await CounterContract.at(counterAddress, wallet);
245245

@@ -254,5 +254,8 @@ async function fundFPC(
254254
.send()
255255
.wait({ proven: true, provenTimeout: 600 });
256256

257-
await feeJuiceContract.methods.claim(fpcAddress, amount, secret).send().wait({ proven: true, provenTimeout: 600 });
257+
await feeJuiceContract.methods
258+
.claim(fpcAddress, claimAmount, claimSecret)
259+
.send()
260+
.wait({ proven: true, provenTimeout: 600 });
258261
}

yarn-project/cli/src/cmds/l1/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: DebugL
108108
'test test test test test test test test test test test junk',
109109
)
110110
.option('--mint', 'Mint the tokens on L1', false)
111+
.option('--private', 'If the bridge should use the private flow', true)
111112
.addOption(l1ChainIdOption)
112113
.requiredOption('-t, --token <string>', 'The address of the token to bridge', parseEthereumAddress)
113114
.requiredOption('-p, --portal <string>', 'The address of the portal contract', parseEthereumAddress)
@@ -124,6 +125,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: DebugL
124125
options.mnemonic,
125126
options.token,
126127
options.portal,
128+
options.private,
127129
options.mint,
128130
options.json,
129131
log,

0 commit comments

Comments
 (0)