Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/busy-bags-sing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cartesi/cli": patch
---

Add `TestUsdc` to the devnet address book, and `RefundOutputBuilder` and `UsdWithdrawalOutputBuilderFactory` to the common one.
5 changes: 5 additions & 0 deletions .changeset/eleven-actors-spend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cartesi/cli": patch
---

Fix `cartesi deposit` for ERC-20, ERC-721 and ERC-1155 against the renamed portal functions.
5 changes: 5 additions & 0 deletions .changeset/rotten-roses-write.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cartesi/cli": patch
---

Fix fork validation against rollups-contracts 3.0.0-alpha.10 and dave 3.0.0-alpha.4.
5 changes: 5 additions & 0 deletions .changeset/thick-experts-notice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cartesi/cli": patch
---

Generate contracts from the rollups-contracts and dave releases instead of `@cartesi/devnet`.
3 changes: 1 addition & 2 deletions apps/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@
"yaml": "^2.8.2"
},
"devDependencies": {
"@cartesi/devnet": "2.0.0-alpha.14",
"@sunodo/wagmi-plugin-hardhat-deploy": "^0.4.0",
"@cartesi/wagmi-plugin": "1.0.0-alpha.7",
"@types/bun": "^1.3.6",
"@types/bytes": "^3.1.5",
"@types/fs-extra": "^11.0.4",
Expand Down
7 changes: 7 additions & 0 deletions apps/cli/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ import {
erc721PortalAddress,
etherPortalAddress,
inputBoxAddress,
refundOutputBuilderAddress,
selfHostedApplicationFactoryAddress,
testFungibleTokenAddress,
testMultiTokenAddress,
testNonFungibleTokenAddress,
testUsdcAddress,
testUsdWithdrawalOutputBuilderAddress,
usdWithdrawalOutputBuilderFactoryAddress,
} from "./contracts.js";
import { cartesiMachineStoredHash } from "./exec";
import { getApplicationAddress, getForkConfig } from "./exec/rollups.js";
Expand Down Expand Up @@ -118,6 +121,7 @@ export const getAddressBook = async (options: {
TestToken: testFungibleTokenAddress,
TestNFT: testNonFungibleTokenAddress,
TestMultiToken: testMultiTokenAddress,
TestUsdc: testUsdcAddress,
TestUsdWithdrawalOutputBuilder: testUsdWithdrawalOutputBuilderAddress,
};

Expand All @@ -132,7 +136,10 @@ export const getAddressBook = async (options: {
ERC721Portal: erc721PortalAddress,
EtherPortal: etherPortalAddress,
InputBox: inputBoxAddress,
RefundOutputBuilder: refundOutputBuilderAddress,
SelfHostedApplicationFactory: selfHostedApplicationFactoryAddress,
UsdWithdrawalOutputBuilderFactory:
usdWithdrawalOutputBuilderFactoryAddress,
};

// gather all contracts, depending whether is fork or devnet
Expand Down
4 changes: 2 additions & 2 deletions apps/cli/src/commands/deposit/erc1155.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export const createErc1155SingleCommand = () => {
abi: erc1155SinglePortalAbi,
account,
address: erc1155SinglePortalAddress,
functionName: "depositSingleERC1155Token",
functionName: "depositSingleErc1155Token",
args: [
token.address,
application,
Expand Down Expand Up @@ -311,7 +311,7 @@ export const createErc1155BatchCommand = () => {
abi: erc1155BatchPortalAbi,
account,
address: erc1155BatchPortalAddress,
functionName: "depositBatchERC1155Token",
functionName: "depositBatchErc1155Token",
args: [
token.address,
application,
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/src/commands/deposit/erc20.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export const createErc20Command = () => {
abi: erc20PortalAbi,
account,
address: erc20PortalAddress,
functionName: "depositERC20Tokens",
functionName: "depositErc20Tokens",
args: [token.address, application, amount, execLayerData],
});

Expand Down
2 changes: 1 addition & 1 deletion apps/cli/src/commands/deposit/erc721.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export const createErc721Command = () => {
abi: erc721PortalAbi,
account,
address: erc721PortalAddress,
functionName: "depositERC721Token",
functionName: "depositErc721Token",
args: [
token.address,
application,
Expand Down
13 changes: 8 additions & 5 deletions apps/cli/src/validations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const getContractCheckers = (options: ContractCheckersOptions) => {
return {
address: this.getAddress(),
abi: etherPortalConfig.abi,
functionName: "getInputBox",
functionName: "version",
args: [],
blockNumber: options.blockNumber,
};
Expand All @@ -87,7 +87,7 @@ const getContractCheckers = (options: ContractCheckersOptions) => {
return {
address: this.getAddress(),
abi: erc20PortalConfig.abi,
functionName: "getInputBox",
functionName: "version",
args: [],
blockNumber: options.blockNumber,
};
Expand All @@ -105,7 +105,7 @@ const getContractCheckers = (options: ContractCheckersOptions) => {
return {
address: this.getAddress(),
abi: erc721PortalConfig.abi,
functionName: "getInputBox",
functionName: "version",
args: [],
blockNumber: options.blockNumber,
};
Expand All @@ -123,7 +123,7 @@ const getContractCheckers = (options: ContractCheckersOptions) => {
return {
address: this.getAddress(),
abi: erc1155SinglePortalConfig.abi,
functionName: "getInputBox",
functionName: "version",
args: [],
blockNumber: options.blockNumber,
};
Expand All @@ -141,7 +141,7 @@ const getContractCheckers = (options: ContractCheckersOptions) => {
return {
address: this.getAddress(),
abi: erc1155BatchPortalConfig.abi,
functionName: "getInputBox",
functionName: "version",
args: [],
blockNumber: options.blockNumber,
};
Expand Down Expand Up @@ -177,6 +177,9 @@ const getContractCheckers = (options: ContractCheckersOptions) => {
functionName: "calculateDaveAppAddress",
args: [
zeroHash,
0n,
zeroAddress,
[],
{
accountsDriveStartIndex: 0n,
guardian: zeroAddress,
Expand Down
7 changes: 7 additions & 0 deletions apps/cli/tests/unit/validations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,36 +102,42 @@ describe("validations", () => {
expect(mockReadContract).toHaveBeenCalledWith(
expect.objectContaining({
address: inputBoxConfig.address,
functionName: "getDeploymentBlockNumber",
}),
);

expect(mockReadContract).toHaveBeenCalledWith(
expect.objectContaining({
address: etherPortalConfig.address,
functionName: "version",
}),
);

expect(mockReadContract).toHaveBeenCalledWith(
expect.objectContaining({
address: erc20PortalConfig.address,
functionName: "version",
}),
);

expect(mockReadContract).toHaveBeenCalledWith(
expect.objectContaining({
address: erc721PortalConfig.address,
functionName: "version",
}),
);

expect(mockReadContract).toHaveBeenCalledWith(
expect.objectContaining({
address: erc1155SinglePortalConfig.address,
functionName: "version",
}),
);

expect(mockReadContract).toHaveBeenCalledWith(
expect.objectContaining({
address: erc1155BatchPortalConfig.address,
functionName: "version",
}),
);

Expand Down Expand Up @@ -272,6 +278,7 @@ describe("validations", () => {
expect(mockReadContract).toHaveBeenCalledWith(
expect.objectContaining({
address: daveAppFactoryAddress[sepolia.id],
functionName: "calculateDaveAppAddress",
}),
);
});
Expand Down
9 changes: 5 additions & 4 deletions apps/cli/wagmi.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import hardhatDeploy from "@sunodo/wagmi-plugin-hardhat-deploy";
import { prtInternals, rollupsContracts } from "@cartesi/wagmi-plugin";
import { defineConfig } from "@wagmi/cli";

export default defineConfig({
out: "src/contracts.ts",
plugins: [
hardhatDeploy({
directory: "node_modules/@cartesi/devnet/deployments",
}),
// the PRT internals are reached through the interfaces they implement,
// or have nothing callable at all, and wagmi repeats each ABI type per
// contract member, so generating them is pure weight
rollupsContracts({ prt: true, exclude: prtInternals }),
],
});
Loading
Loading