diff --git a/packages/nextjs/contracts/deployedContracts.ts b/packages/nextjs/contracts/deployedContracts.ts index 36267d7..25751ce 100755 --- a/packages/nextjs/contracts/deployedContracts.ts +++ b/packages/nextjs/contracts/deployedContracts.ts @@ -3,518 +3,6 @@ * You should not edit it manually or your changes might be overwritten. */ -const deployedContracts = { - devnet: { - crowdfunding: { - address: - "0x52918871346ac5de0570a00a0adbcbd2f98594f2db1422c3a4dd2290770a2bc", - abi: [ - { - type: "impl", - name: "CrowdFundingImpl", - interface_name: "crowdfunding::crowdfunding::IFund", - }, - { - type: "struct", - name: "core::integer::u256", - members: [ - { - name: "low", - type: "core::integer::u128", - }, - { - name: "high", - type: "core::integer::u128", - }, - ], - }, - { - type: "struct", - name: "core::byte_array::ByteArray", - members: [ - { - name: "data", - type: "core::array::Array::", - }, - { - name: "pending_word", - type: "core::felt252", - }, - { - name: "pending_word_len", - type: "core::integer::u32", - }, - ], - }, - { - type: "enum", - name: "core::bool", - variants: [ - { - name: "False", - type: "()", - }, - { - name: "True", - type: "()", - }, - ], - }, - { - type: "interface", - name: "crowdfunding::crowdfunding::IFund", - items: [ - { - type: "function", - name: "get_fund_balance", - inputs: [], - outputs: [ - { - type: "core::integer::u256", - }, - ], - state_mutability: "view", - }, - { - type: "function", - name: "get_fund_target", - inputs: [], - outputs: [ - { - type: "core::integer::u256", - }, - ], - state_mutability: "view", - }, - { - type: "function", - name: "get_fund_description", - inputs: [], - outputs: [ - { - type: "core::felt252", - }, - ], - state_mutability: "view", - }, - { - type: "function", - name: "get_deadline", - inputs: [], - outputs: [ - { - type: "core::felt252", - }, - ], - state_mutability: "view", - }, - { - type: "function", - name: "get_token_symbol", - inputs: [], - outputs: [ - { - type: "core::byte_array::ByteArray", - }, - ], - state_mutability: "view", - }, - { - type: "function", - name: "get_token_address", - inputs: [], - outputs: [ - { - type: "core::starknet::contract_address::ContractAddress", - }, - ], - state_mutability: "view", - }, - { - type: "function", - name: "fund_to_contract", - inputs: [ - { - name: "amount", - type: "core::integer::u256", - }, - ], - outputs: [], - state_mutability: "external", - }, - { - type: "function", - name: "withdraw_funds", - inputs: [], - outputs: [], - state_mutability: "external", - }, - { - type: "function", - name: "reset_fund", - inputs: [ - { - name: "token", - type: "core::starknet::contract_address::ContractAddress", - }, - { - name: "grantee_address", - type: "core::starknet::contract_address::ContractAddress", - }, - { - name: "fund_target", - type: "core::integer::u256", - }, - { - name: "fund_description", - type: "core::felt252", - }, - { - name: "deadline", - type: "core::felt252", - }, - { - name: "initial_owner", - type: "core::starknet::contract_address::ContractAddress", - }, - ], - outputs: [], - state_mutability: "external", - }, - { - type: "function", - name: "get_owner", - inputs: [], - outputs: [ - { - type: "core::starknet::contract_address::ContractAddress", - }, - ], - state_mutability: "view", - }, - { - type: "function", - name: "get_active", - inputs: [], - outputs: [ - { - type: "core::bool", - }, - ], - state_mutability: "view", - }, - { - type: "function", - name: "set_active", - inputs: [ - { - name: "new_active", - type: "core::bool", - }, - ], - outputs: [], - state_mutability: "external", - }, - ], - }, - { - type: "impl", - name: "OwnableMixinImpl", - interface_name: "openzeppelin_access::ownable::interface::OwnableABI", - }, - { - type: "interface", - name: "openzeppelin_access::ownable::interface::OwnableABI", - items: [ - { - type: "function", - name: "owner", - inputs: [], - outputs: [ - { - type: "core::starknet::contract_address::ContractAddress", - }, - ], - state_mutability: "view", - }, - { - type: "function", - name: "transfer_ownership", - inputs: [ - { - name: "new_owner", - type: "core::starknet::contract_address::ContractAddress", - }, - ], - outputs: [], - state_mutability: "external", - }, - { - type: "function", - name: "renounce_ownership", - inputs: [], - outputs: [], - state_mutability: "external", - }, - { - type: "function", - name: "transferOwnership", - inputs: [ - { - name: "newOwner", - type: "core::starknet::contract_address::ContractAddress", - }, - ], - outputs: [], - state_mutability: "external", - }, - { - type: "function", - name: "renounceOwnership", - inputs: [], - outputs: [], - state_mutability: "external", - }, - ], - }, - { - type: "constructor", - name: "constructor", - inputs: [ - { - name: "token", - type: "core::starknet::contract_address::ContractAddress", - }, - { - name: "grantee_address", - type: "core::starknet::contract_address::ContractAddress", - }, - { - name: "fund_target", - type: "core::integer::u256", - }, - { - name: "fund_description", - type: "core::felt252", - }, - { - name: "deadline", - type: "core::felt252", - }, - { - name: "initial_owner", - type: "core::starknet::contract_address::ContractAddress", - }, - ], - }, - { - type: "event", - name: "openzeppelin_access::ownable::ownable::OwnableComponent::OwnershipTransferred", - kind: "struct", - members: [ - { - name: "previous_owner", - type: "core::starknet::contract_address::ContractAddress", - kind: "key", - }, - { - name: "new_owner", - type: "core::starknet::contract_address::ContractAddress", - kind: "key", - }, - ], - }, - { - type: "event", - name: "openzeppelin_access::ownable::ownable::OwnableComponent::OwnershipTransferStarted", - kind: "struct", - members: [ - { - name: "previous_owner", - type: "core::starknet::contract_address::ContractAddress", - kind: "key", - }, - { - name: "new_owner", - type: "core::starknet::contract_address::ContractAddress", - kind: "key", - }, - ], - }, - { - type: "event", - name: "openzeppelin_access::ownable::ownable::OwnableComponent::Event", - kind: "enum", - variants: [ - { - name: "OwnershipTransferred", - type: "openzeppelin_access::ownable::ownable::OwnableComponent::OwnershipTransferred", - kind: "nested", - }, - { - name: "OwnershipTransferStarted", - type: "openzeppelin_access::ownable::ownable::OwnableComponent::OwnershipTransferStarted", - kind: "nested", - }, - ], - }, - { - type: "event", - name: "crowdfunding::crowdfunding::crowdfunding::SelfDestructed", - kind: "struct", - members: [ - { - name: "recipient", - type: "core::starknet::contract_address::ContractAddress", - kind: "data", - }, - { - name: "amount", - type: "core::integer::u256", - kind: "data", - }, - ], - }, - { - type: "event", - name: "crowdfunding::crowdfunding::crowdfunding::Transfer", - kind: "struct", - members: [ - { - name: "from", - type: "core::starknet::contract_address::ContractAddress", - kind: "data", - }, - { - name: "to", - type: "core::starknet::contract_address::ContractAddress", - kind: "data", - }, - { - name: "amount", - type: "core::integer::u256", - kind: "data", - }, - ], - }, - { - type: "event", - name: "crowdfunding::crowdfunding::crowdfunding::TransferFailed", - kind: "struct", - members: [ - { - name: "from", - type: "core::starknet::contract_address::ContractAddress", - kind: "data", - }, - { - name: "to", - type: "core::starknet::contract_address::ContractAddress", - kind: "data", - }, - { - name: "amount", - type: "core::integer::u256", - kind: "data", - }, - { - name: "error_message", - type: "core::felt252", - kind: "data", - }, - ], - }, - { - type: "event", - name: "crowdfunding::crowdfunding::crowdfunding::ResetFund", - kind: "struct", - members: [ - { - name: "token", - type: "core::starknet::contract_address::ContractAddress", - kind: "data", - }, - { - name: "grantee_address", - type: "core::starknet::contract_address::ContractAddress", - kind: "data", - }, - { - name: "fund_target", - type: "core::integer::u256", - kind: "data", - }, - { - name: "fund_description", - type: "core::felt252", - kind: "data", - }, - { - name: "deadline", - type: "core::felt252", - kind: "data", - }, - { - name: "initial_owner", - type: "core::starknet::contract_address::ContractAddress", - kind: "data", - }, - ], - }, - { - type: "event", - name: "crowdfunding::crowdfunding::crowdfunding::ActiveChanged", - kind: "struct", - members: [ - { - name: "active", - type: "core::bool", - kind: "data", - }, - ], - }, - { - type: "event", - name: "crowdfunding::crowdfunding::crowdfunding::Event", - kind: "enum", - variants: [ - { - name: "OwnableEvent", - type: "openzeppelin_access::ownable::ownable::OwnableComponent::Event", - kind: "flat", - }, - { - name: "SelfDestructed", - type: "crowdfunding::crowdfunding::crowdfunding::SelfDestructed", - kind: "nested", - }, - { - name: "Transfer", - type: "crowdfunding::crowdfunding::crowdfunding::Transfer", - kind: "nested", - }, - { - name: "TransferFailed", - type: "crowdfunding::crowdfunding::crowdfunding::TransferFailed", - kind: "nested", - }, - { - name: "ResetFund", - type: "crowdfunding::crowdfunding::crowdfunding::ResetFund", - kind: "nested", - }, - { - name: "ActiveChanged", - type: "crowdfunding::crowdfunding::crowdfunding::ActiveChanged", - kind: "nested", - }, - ], - }, - ], - classHash: - "0x7ef9da282b80201adeb247d70afa2b5904553321ec28af776261f36306c42f7", - }, - }, -} as const; +const deployedContracts = {} as const; export default deployedContracts; diff --git a/packages/snfoundry/contracts/Scarb.lock b/packages/snfoundry/contracts/Scarb.lock index 57f8657..a5384aa 100644 --- a/packages/snfoundry/contracts/Scarb.lock +++ b/packages/snfoundry/contracts/Scarb.lock @@ -2,31 +2,13 @@ version = 1 [[package]] -name = "crowdfunding" +name = "contracts" version = "0.2.0" -dependencies = [ - "openzeppelin", - "openzeppelin_utils", - "snforge_std", -] - -[[package]] -name = "openzeppelin" -version = "0.20.0" -source = "registry+https://scarbs.xyz/" -checksum = "sha256:05fd9365be85a4a3e878135d5c52229f760b3861ce4ed314cb1e75b178b553da" dependencies = [ "openzeppelin_access", - "openzeppelin_account", - "openzeppelin_finance", - "openzeppelin_governance", - "openzeppelin_introspection", - "openzeppelin_merkle_tree", - "openzeppelin_presets", - "openzeppelin_security", "openzeppelin_token", - "openzeppelin_upgrades", "openzeppelin_utils", + "snforge_std", ] [[package]] @@ -48,62 +30,12 @@ dependencies = [ "openzeppelin_utils", ] -[[package]] -name = "openzeppelin_finance" -version = "0.20.0" -source = "registry+https://scarbs.xyz/" -checksum = "sha256:f0c507fbff955e4180ea3fa17949c0ff85518c40101f4948948d9d9a74143d6c" -dependencies = [ - "openzeppelin_access", - "openzeppelin_token", -] - -[[package]] -name = "openzeppelin_governance" -version = "0.20.0" -source = "registry+https://scarbs.xyz/" -checksum = "sha256:c0fb60fad716413d537fabd5fcbb2c499ca6beb95af5f0d1699955ecec4c6f63" -dependencies = [ - "openzeppelin_access", - "openzeppelin_account", - "openzeppelin_introspection", - "openzeppelin_token", - "openzeppelin_utils", -] - [[package]] name = "openzeppelin_introspection" version = "0.20.0" source = "registry+https://scarbs.xyz/" checksum = "sha256:13e04a2190684e6804229a77a6c56de7d033db8b9ef519e5e8dee400a70d8a3d" -[[package]] -name = "openzeppelin_merkle_tree" -version = "0.20.0" -source = "registry+https://scarbs.xyz/" -checksum = "sha256:039608900e92f3dcf479bf53a49a1fd76452acd97eb86e390d1eb92cacdaf3af" - -[[package]] -name = "openzeppelin_presets" -version = "0.20.0" -source = "registry+https://scarbs.xyz/" -checksum = "sha256:5c07a8de32e5d9abe33988c7927eaa8b5f83bc29dc77302d9c8c44c898611042" -dependencies = [ - "openzeppelin_access", - "openzeppelin_account", - "openzeppelin_finance", - "openzeppelin_introspection", - "openzeppelin_token", - "openzeppelin_upgrades", - "openzeppelin_utils", -] - -[[package]] -name = "openzeppelin_security" -version = "0.20.0" -source = "registry+https://scarbs.xyz/" -checksum = "sha256:27155597019ecf971c48d7bfb07fa58cdc146d5297745570071732abca17f19f" - [[package]] name = "openzeppelin_token" version = "0.20.0" @@ -116,12 +48,6 @@ dependencies = [ "openzeppelin_utils", ] -[[package]] -name = "openzeppelin_upgrades" -version = "0.20.0" -source = "registry+https://scarbs.xyz/" -checksum = "sha256:15fdd63f6b50a0fda7b3f8f434120aaf7637bcdfe6fd8d275ad57343d5ede5e1" - [[package]] name = "openzeppelin_utils" version = "0.20.0" diff --git a/packages/snfoundry/contracts/Scarb.toml b/packages/snfoundry/contracts/Scarb.toml index d0c4b00..1776f5b 100644 --- a/packages/snfoundry/contracts/Scarb.toml +++ b/packages/snfoundry/contracts/Scarb.toml @@ -1,5 +1,5 @@ [package] -name = "crowdfunding" +name = "contracts" version = "0.2.0" edition = "2023_11" @@ -7,7 +7,9 @@ edition = "2023_11" [dependencies] starknet = "2.9.2" -openzeppelin = "0.20.0" +# Change to just "openzeppelin" to use full features +openzeppelin_access = "0.20.0" +openzeppelin_token = "0.20.0" [dev-dependencies] openzeppelin_utils = "0.20.0" @@ -16,6 +18,7 @@ cairo_test = "2.9.2" [[target.starknet-contract]] casm = true +sierra = true allowed-libfuncs-list.name = "experimental" [tool.fmt] diff --git a/packages/snfoundry/contracts/src/crowdfunding.cairo b/packages/snfoundry/contracts/src/crowdfunding.cairo index 8eef092..494bd76 100755 --- a/packages/snfoundry/contracts/src/crowdfunding.cairo +++ b/packages/snfoundry/contracts/src/crowdfunding.cairo @@ -68,9 +68,9 @@ pub mod crowdfunding { use starknet::ContractAddress; use starknet::event::EventEmitter; use starknet::get_caller_address; - use openzeppelin::access::ownable::{OwnableComponent}; - use openzeppelin::token::erc20::interface::{IERC20Dispatcher, IERC20DispatcherTrait}; - use openzeppelin::token::erc20::interface::{IERC20MetadataDispatcher, IERC20MetadataDispatcherTrait}; + use openzeppelin_access::ownable::{OwnableComponent}; + use openzeppelin_token::erc20::interface::{IERC20Dispatcher, IERC20DispatcherTrait}; + use openzeppelin_token::erc20::interface::{IERC20MetadataDispatcher, IERC20MetadataDispatcherTrait}; use core::traits::TryInto; // Ownable component integration diff --git a/packages/snfoundry/scripts-ts/deploy-contract.ts b/packages/snfoundry/scripts-ts/deploy-contract.ts index 71a0878..fcf1e41 100644 --- a/packages/snfoundry/scripts-ts/deploy-contract.ts +++ b/packages/snfoundry/scripts-ts/deploy-contract.ts @@ -67,6 +67,7 @@ const declareIfNot_NotWait = async ( } catch (error) { try { const isSierraContract = isSierra(payload.contract); + console.log('networkName: {}',networkName); const txVersion = await getTxVersion( networks[networkName], feeToken, diff --git a/packages/snfoundry/scripts-ts/deploy.ts b/packages/snfoundry/scripts-ts/deploy.ts index f36863b..e91cd3a 100644 --- a/packages/snfoundry/scripts-ts/deploy.ts +++ b/packages/snfoundry/scripts-ts/deploy.ts @@ -2,10 +2,8 @@ import { deployContract, executeDeployCalls, exportDeployments, - deployer, } from "./deploy-contract"; import { green } from "./helpers/colorize-log"; - /** * Deploy a contract using the specified parameters. * @@ -44,6 +42,7 @@ import { green } from "./helpers/colorize-log"; const deployScript = async (): Promise => { await deployContract({ contract: "crowdfunding", + contractName: "crowdfunding", constructorArgs: { token: process.env.STRK_SEPOLIA_ADDRESS ?? "", grantee_address: process.env.GRANTEE_ADDRESS ?? "", @@ -52,6 +51,9 @@ const deployScript = async (): Promise => { deadline: process.env.DEADLINE ?? "", initial_owner: process.env.ACCOUNT_ADDRESS_SEPOLIA ?? "", }, +/* options: { + maxFee: BigInt("1000000000000000000000000000000") + }*/ }); }; diff --git a/packages/snfoundry/scripts-ts/helpers/parse-deployments.ts b/packages/snfoundry/scripts-ts/helpers/parse-deployments.ts index e9819c2..aa2490c 100644 --- a/packages/snfoundry/scripts-ts/helpers/parse-deployments.ts +++ b/packages/snfoundry/scripts-ts/helpers/parse-deployments.ts @@ -33,12 +33,12 @@ const getContractDataFromDeployments = (): Record< } > = JSON.parse(fs.readFileSync(filePath, "utf8")); const chainId = path.basename(file, "_latest.json"); -console.log('3333',chainId); + Object.entries(content).forEach(([contractName, contractData]) => { try { const abiFilePath = path.join( __dirname, - `../../contracts/target/dev/${contractData.contract}_${contractData.contract}.contract_class.json` + `../../contracts/target/dev/contracts_${contractData.contract}.contract_class.json` ); const abiContent: CompiledSierra = JSON.parse( fs.readFileSync(abiFilePath, "utf8") @@ -62,6 +62,7 @@ console.log('3333',chainId); const generateTsAbis = () => { const allContractsData = getContractDataFromDeployments(); + const fileContent = Object.entries(allContractsData).reduce( (content, [chainId, chainConfig]) => { // Use chainId directly as it is already a hex string