Skip to content

Commit ae4bc46

Browse files
authored
fix(noir-contracts): remove easy reference from private token contract (#16624)
This is part of addressing Zac's feedback on Slack.
2 parents df1f722 + d9a6a81 commit ae4bc46

File tree

10 files changed

+21
-24
lines changed

10 files changed

+21
-24
lines changed

docs/docs/developers/reference/environment_reference/sandbox-reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ ContractInstanceRegistryContractArtifact
118118
CounterContractArtifact
119119
CrowdfundingContractArtifact
120120
DocsExampleContractArtifact
121-
EasyPrivateTokenContractArtifact
121+
PrivateTokenContractArtifact
122122
PrivateVotingContractArtifact
123123
EcdsaAccountContractArtifact
124124
EscrowContractArtifact

noir-projects/noir-contracts/Nargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ members = [
1212
"contracts/app/card_game_contract",
1313
"contracts/app/claim_contract",
1414
"contracts/app/crowdfunding_contract",
15-
"contracts/app/easy_private_token_contract",
15+
"contracts/app/private_token_contract",
1616
"contracts/app/private_voting_contract",
1717
"contracts/app/escrow_contract",
1818
"contracts/app/lending_contract",

noir-projects/noir-contracts/contracts/app/easy_private_token_contract/Nargo.toml renamed to noir-projects/noir-contracts/contracts/app/private_token_contract/Nargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "easy_private_token_contract"
2+
name = "private_token_contract"
33
authors = [""]
44
compiler_version = ">=0.25.0"
55
type = "contract"

noir-projects/noir-contracts/contracts/app/easy_private_token_contract/src/main.nr renamed to noir-projects/noir-contracts/contracts/app/private_token_contract/src/main.nr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// docs:start:easy_private_token_contract
1+
// docs:start:private_token_contract
22
use dep::aztec::macros::aztec;
33

44
#[aztec]
5-
pub contract EasyPrivateToken {
5+
pub contract PrivateToken {
66
use dep::aztec::macros::{functions::{initializer, private, utility}, storage::storage};
77
use dep::aztec::{protocol_types::address::AztecAddress, state_vars::Map};
88
use dep::easy_private_state::EasyPrivateUint;
@@ -46,4 +46,4 @@ pub contract EasyPrivateToken {
4646
storage.balances.at(owner).get_value()
4747
}
4848
}
49-
// docs:end:easy_private_token_contract
49+
// docs:end:private_token_contract

yarn-project/bot/src/bot.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { type AztecAddress, BatchCall, SentTx, type Wallet } from '@aztec/aztec.js';
22
import { times } from '@aztec/foundation/collection';
3-
import type { EasyPrivateTokenContract } from '@aztec/noir-contracts.js/EasyPrivateToken';
3+
import type { PrivateTokenContract } from '@aztec/noir-contracts.js/PrivateToken';
44
import type { TokenContract } from '@aztec/noir-contracts.js/Token';
55
import type { AztecNode, AztecNodeAdmin, PXE } from '@aztec/stdlib/interfaces/client';
66

@@ -16,7 +16,7 @@ export class Bot extends BaseBot {
1616
pxe: PXE,
1717
wallet: Wallet,
1818
defaultAccountAddress: AztecAddress,
19-
public readonly token: TokenContract | EasyPrivateTokenContract,
19+
public readonly token: TokenContract | PrivateTokenContract,
2020
public readonly recipient: AztecAddress,
2121
config: BotConfig,
2222
) {

yarn-project/bot/src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ type BotFollowChain = (typeof BotFollowChain)[number];
2222

2323
export enum SupportedTokenContracts {
2424
TokenContract = 'TokenContract',
25-
EasyPrivateTokenContract = 'EasyPrivateTokenContract',
25+
PrivateTokenContract = 'PrivateTokenContract',
2626
}
2727

2828
export type BotConfig = {

yarn-project/bot/src/factory.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { createEthereumChain, createExtendedL1Client } from '@aztec/ethereum';
1919
import { Fr } from '@aztec/foundation/fields';
2020
import { Timer } from '@aztec/foundation/timer';
2121
import { AMMContract } from '@aztec/noir-contracts.js/AMM';
22-
import { EasyPrivateTokenContract } from '@aztec/noir-contracts.js/EasyPrivateToken';
22+
import { PrivateTokenContract } from '@aztec/noir-contracts.js/PrivateToken';
2323
import { TokenContract } from '@aztec/noir-contracts.js/Token';
2424
import type { AztecNode, AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
2525
import { deriveSigningKey } from '@aztec/stdlib/keys';
@@ -189,20 +189,17 @@ export class BotFactory {
189189
* @param wallet - Wallet to deploy the token contract from.
190190
* @returns The TokenContract instance.
191191
*/
192-
private async setupToken(
193-
wallet: AccountWallet,
194-
sender: AztecAddress,
195-
): Promise<TokenContract | EasyPrivateTokenContract> {
196-
let deploy: DeployMethod<TokenContract | EasyPrivateTokenContract>;
192+
private async setupToken(wallet: AccountWallet, sender: AztecAddress): Promise<TokenContract | PrivateTokenContract> {
193+
let deploy: DeployMethod<TokenContract | PrivateTokenContract>;
197194
const deployOpts: DeployOptions = {
198195
from: sender,
199196
contractAddressSalt: this.config.tokenSalt,
200197
universalDeploy: true,
201198
};
202199
if (this.config.contract === SupportedTokenContracts.TokenContract) {
203200
deploy = TokenContract.deploy(wallet, sender, 'BotToken', 'BOT', 18);
204-
} else if (this.config.contract === SupportedTokenContracts.EasyPrivateTokenContract) {
205-
deploy = EasyPrivateTokenContract.deploy(wallet, MINT_BALANCE, sender);
201+
} else if (this.config.contract === SupportedTokenContracts.PrivateTokenContract) {
202+
deploy = PrivateTokenContract.deploy(wallet, MINT_BALANCE, sender);
206203
deployOpts.skipInstancePublication = true;
207204
deployOpts.skipClassPublication = true;
208205
deployOpts.skipInitialization = false;
@@ -358,7 +355,7 @@ export class BotFactory {
358355
* Mints private and public tokens for the sender if their balance is below the minimum.
359356
* @param token - Token contract.
360357
*/
361-
private async mintTokens(token: TokenContract | EasyPrivateTokenContract, minter: AztecAddress) {
358+
private async mintTokens(token: TokenContract | PrivateTokenContract, minter: AztecAddress) {
362359
const isStandardToken = isStandardTokenContract(token);
363360
let privateBalance = 0n;
364361
let publicBalance = 0n;

yarn-project/bot/src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { ContractBase } from '@aztec/aztec.js';
22
import type { AMMContract } from '@aztec/noir-contracts.js/AMM';
3-
import type { EasyPrivateTokenContract } from '@aztec/noir-contracts.js/EasyPrivateToken';
3+
import type { PrivateTokenContract } from '@aztec/noir-contracts.js/PrivateToken';
44
import type { TokenContract } from '@aztec/noir-contracts.js/Token';
55
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
66

@@ -19,7 +19,7 @@ export async function getBalances(
1919
return { privateBalance, publicBalance };
2020
}
2121

22-
export async function getPrivateBalance(token: EasyPrivateTokenContract, who: AztecAddress): Promise<bigint> {
22+
export async function getPrivateBalance(token: PrivateTokenContract, who: AztecAddress): Promise<bigint> {
2323
const privateBalance = await token.methods.get_balance(who).simulate({ from: who });
2424
return privateBalance;
2525
}

yarn-project/end-to-end/src/e2e_bot.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ describe('e2e_bot', () => {
5858
expect(bot2.recipient.toString()).toEqual(recipient.toString());
5959
});
6060

61-
it('sends token from the bot using EasyPrivateToken', async () => {
61+
it('sends token from the bot using PrivateToken', async () => {
6262
const easyBot = await Bot.create(
6363
{
6464
...config,
65-
contract: SupportedTokenContracts.EasyPrivateTokenContract,
65+
contract: SupportedTokenContracts.PrivateTokenContract,
6666
},
6767
{ pxe },
6868
);

yarn-project/end-to-end/src/e2e_public_testnet/e2e_public_testnet_transfer.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { AccountWalletWithSecretKey, AztecAddress, Logger } from '@aztec/aztec.js';
2-
import { EasyPrivateTokenContract } from '@aztec/noir-contracts.js/EasyPrivateToken';
2+
import { PrivateTokenContract } from '@aztec/noir-contracts.js/PrivateToken';
33

44
import { foundry, sepolia } from 'viem/chains';
55

@@ -47,7 +47,7 @@ describe(`deploys and transfers a private only token`, () => {
4747
const initialBalance = 100_000_000_000n;
4848
const transferValue = 5n;
4949

50-
const token = await EasyPrivateTokenContract.deploy(deployerWallet, initialBalance, deployerAddress)
50+
const token = await PrivateTokenContract.deploy(deployerWallet, initialBalance, deployerAddress)
5151
.send({
5252
from: deployerAddress,
5353
universalDeploy: true,

0 commit comments

Comments
 (0)