Skip to content

Commit a3735c5

Browse files
author
sklppy88
committed
fixing build
1 parent 3a78e58 commit a3735c5

5 files changed

Lines changed: 22 additions & 20 deletions

File tree

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

Lines changed: 7 additions & 7 deletions
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

Lines changed: 8 additions & 8 deletions
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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,15 +243,15 @@ async function fundFPC(
243243

244244
const feeJuiceContract = await FeeJuiceContract.at(feeJuice, wallet);
245245

246-
const feeJuicePortal = await FeeJuicePortalManager.create(
246+
const feeJuicePortal = await FeeJuicePortalManager.new(
247247
wallet,
248248
l1Clients.publicClient,
249249
l1Clients.walletClient,
250250
debugLog,
251251
);
252252

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

256256
const counter = await CounterContract.at(counterAddress, wallet);
257257

@@ -260,5 +260,5 @@ async function fundFPC(
260260
await counter.methods.increment(wallet.getAddress(), wallet.getAddress()).send().wait();
261261
await counter.methods.increment(wallet.getAddress(), wallet.getAddress()).send().wait();
262262

263-
await feeJuiceContract.methods.claim(fpcAddress, amount, secret).send().wait();
263+
await feeJuiceContract.methods.claim(fpcAddress, claimAmount, claimSecret).send().wait();
264264
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: DebugL
101101
'test test test test test test test test test test test junk',
102102
)
103103
.option('--mint', 'Mint the tokens on L1', false)
104+
.option('--private', 'If the bridge should use the private flow', false)
104105
.addOption(l1ChainIdOption)
105106
.requiredOption('-t, --token <string>', 'The address of the token to bridge', parseEthereumAddress)
106107
.requiredOption('-p, --portal <string>', 'The address of the portal contract', parseEthereumAddress)
@@ -117,6 +118,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: DebugL
117118
options.mnemonic,
118119
options.token,
119120
options.portal,
121+
options.private,
120122
options.mint,
121123
options.json,
122124
log,

yarn-project/cli/src/utils/portal_manager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class L1TokenManager {
6262
}
6363

6464
public async approve(amount: bigint, address: Hex, addressName = '') {
65-
this.logger.info(`Minting ${amount} tokens for ${stringifyEthAddress(address, addressName)}`);
65+
this.logger.info(`Approving ${amount} tokens for ${stringifyEthAddress(address, addressName)}`);
6666
await this.publicClient.waitForTransactionReceipt({
6767
hash: await this.contract.write.approve([address, amount]),
6868
});
@@ -123,7 +123,7 @@ export class FeeJuicePortalManager {
123123
throw new Error('Portal or token not deployed on L1');
124124
}
125125

126-
return new FeeJuicePortalManager(feeJuicePortalAddress, feeJuicePortalAddress, publicClient, walletClient, logger);
126+
return new FeeJuicePortalManager(feeJuicePortalAddress, feeJuiceAddress, publicClient, walletClient, logger);
127127
}
128128
}
129129

0 commit comments

Comments
 (0)