diff --git a/.env.example b/.env.example index f9c9710..3c929c1 100644 --- a/.env.example +++ b/.env.example @@ -1,21 +1,31 @@ ARB_MAINNET_RPC= ARB_MAINNET_PK= - ARB_SEPOLIA_RPC= ARB_SEPOLIA_PK= -ARB_ETHERSCAN_API_KEY= -DEFAULT_KEY_PUBLIC_ADDRESS= +# put the public address of your defaultKey here if you're using the cast wallet +DEFAULT_KEY_PUBLIC_ADDRESS= + +ARB_ETHERSCAN_API_KEY=P6DZ75FA2M4WPHNXTIBGKJX4STQP8CGU4G + # run `anvil` and copy a private key from anvil terminal ANVIL_ONE=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 ANVIL_RPC=http://127.0.0.1:8545 -VAULT721_SEPOLIA_ADDRESS=0x05AC7e3ac152012B980407dEff2655c209667E4c +FOUNDRY_PROFILE=debug + +VAULT712_SEPOLIA_ADDRESS=0x05AC7e3ac152012B980407dEff2655c209667E4c VAULT712_MAINNET_ADDRESS=0x0005AFE00fF7E7FF83667bFe4F2996720BAf0B36 +VAULT721_ANVIL_ADDRESS= -OPENSEA_API_KEY= -WALLET_PRIV_KEY= +OPENSEA_API_KEY=092134c8da1a42eaaf6cc48c0d1c9fc2 -SIP15_ZONE_SEPOLIA_ADDRESS= +SIP15_ZONE_ANVIL_ADDRESS= +SIP15_ZONE_SEPOLIA_ADDRESS=0xD658CB9C7626e147c4bd8B8Ef401f1Fb42cA7695 SIP15_ZONE_MAINNET_ADDRESS= + VAULT712_MAINNET_ADAPATER_ADDRESS= -VAULT721_SEPOLIA_ADAPATER_ADDRESS= \ No newline at end of file +VAULT721_SEPOLIA_ADAPATER_ADDRESS=0xc5736e1F01FB4f013C152B8315019CA20d30FC50 +VAULT721_ANVIL_ADAPATER_ADDRESS= + +ENCODING_HELPER= +ENCODING_HELPER_ANVIL= \ No newline at end of file diff --git a/script/DeploySIP15Zone.s.sol b/script/DeploySIP15Zone.s.sol index 424f559..aed4831 100644 --- a/script/DeploySIP15Zone.s.sol +++ b/script/DeploySIP15Zone.s.sol @@ -56,9 +56,6 @@ contract DeploySIP15ZoneWithENV is Script { console2.log('deployer balance:', deployer.balance); } - function _deploy() internal { - new SIP15Zone(); - } } contract DeploySIP15ZoneWithCastWallet is Script { @@ -89,7 +86,33 @@ contract DeploySIP15ZoneWithCastWallet is Script { } - function _deploy() internal { - new SIP15Zone(); - } } +// source .env && forge script script/DeploySIP15Zone.s.sol:DeployAnvil --with-gas-price 2000000000 -vvvvv --rpc-url $ANVIL_RPC --broadcast +contract DeployAnvil is Script{ + uint256 internal _privateKey; + address public deployer; + address public vault721; + + function run() public { + _loadPrivateKeys(); + + vm.startBroadcast(_privateKey); + address zoneAddress = address(new SIP15Zone()); + address vault721Adapter = address(new Vault721Adapter(IVault721(vault721))); + vm.stopBroadcast(); + console2.log('Zone Deployed at: ', zoneAddress); + console2.log('vault721Adapter Deployed at: ', vault721Adapter); + } + + function _loadPrivateKeys() internal { + + _privateKey = vm.envUint('ANVIL_ONE'); + deployer = vm.addr(_privateKey); + vault721 = vm.envAddress('VAULT721_SEPOLIA_ADDRESS'); // SepoliaContracts.Vault721_Address; + + console2.log('\n'); + console2.log('deployer address:', deployer); + console2.log('deployer balance:', deployer.balance); + } + +} \ No newline at end of file diff --git a/script/createListing.ts b/script/createListing.ts index 0cc9c60..1bb18c3 100644 --- a/script/createListing.ts +++ b/script/createListing.ts @@ -1,51 +1,106 @@ -import { BytesLike, ethers } from 'ethers'; +import { AddressLike, BigNumberish, BytesLike, ParamType, ethers } from "ethers"; import { - VAULT721_SEPOLIA_ADDRESS, - VAULT721_SEPOLIA_ADAPATER_ADDRESS, - SIP15_ZONE_SEPOLIA_ADDRESS, - ANVIL_ONE, - ANVIL_RPC, - ARB_SEPOLIA_RPC, - WALLET_PRIV_KEY -} from './utils/constants'; -const vault721AdapterABI = require('../out/Vault721Adapter.sol/Vault721Adapter.json'); -const sip15ZoneABI = require('../out/SIP15Zone.sol/SIP15Zone.json'); + VAULT721_SEPOLIA_ADDRESS, + VAULT721_ANVIL_ADDRESS, + VAULT721_SEPOLIA_ADAPATER_ADDRESS, + VAULT721_ANVIL_ADAPATER_ADDRESS, + SIP15_ZONE_SEPOLIA_ADDRESS, + ANVIL_ONE, + ANVIL_RPC, + ARB_SEPOLIA_RPC, + WALLET_PRIV_KEY, + ENCODING_HELPER, + ENCODING_HELPER_ANVIL, +} from "./utils/constants"; +const vault721AdapterABI = require("../out/Vault721Adapter.sol/Vault721Adapter.json"); +const EncodeSubstandard5ForEthersABI = require("../out/EncodeSubstandard5ForEthers.sol/EncodeSubstandard5ForEthers.json"); import { ItemType } from "@opensea/seaport-js/src/constants"; -import { CreateOrderInput } from '@opensea/seaport-js/lib/types'; +import { CreateOrderInput } from "@opensea/seaport-js/lib/types"; import { Seaport } from "@opensea/seaport-js"; -import { Wallet, Provider } from 'ethers'; -import {Vault721Adapter} from '../types/ethers-contracts/index'; +import { Wallet, Provider, AbiCoder } from "ethers"; +import { + Vault721Adapter, + EncodeSubstandard5ForEthers, +} from "../types/ethers-contracts/index"; +import { Address } from "cluster"; const createSIP15ZoneListing = async (chain: string) => { - let provider: Provider; - let wallet: Wallet; - let seaport: Seaport; - if(chain == 'anvil'){ - provider = new ethers.JsonRpcProvider(ANVIL_RPC); - wallet = new ethers.Wallet( - ANVIL_ONE as string, - provider - ); - seaport = new Seaport(wallet); - } else if (chain == 'sepolia'){ - provider = new ethers.JsonRpcProvider(ARB_SEPOLIA_RPC); - wallet = new ethers.Wallet( - WALLET_PRIV_KEY as string, - provider - ); - seaport = new Seaport(wallet); + let provider: Provider; + let wallet: Wallet; + let seaport: Seaport; + let encodeSubstandard5Helper: EncodeSubstandard5ForEthers; + let vault721AdapterAddress: AddressLike; + let vault721Address: AddressLike; + + if (chain == "anvil") { + provider = new ethers.JsonRpcProvider(ANVIL_RPC); + wallet = new ethers.Wallet(ANVIL_ONE as string, provider); + seaport = new Seaport(wallet); + if (VAULT721_ANVIL_ADAPATER_ADDRESS && VAULT721_ANVIL_ADDRESS) { + vault721AdapterAddress = VAULT721_ANVIL_ADAPATER_ADDRESS; + vault721Address = VAULT721_ANVIL_ADDRESS; + } else { + throw new Error("VAULT721_ANVIL_ADAPATER_ADDRESS undefined"); + } + + if (ENCODING_HELPER_ANVIL == undefined) { + const encodeSubstandard5Factory = new ethers.ContractFactory( + EncodeSubstandard5ForEthersABI.abi, + EncodeSubstandard5ForEthersABI.bytecode, + wallet + ); + encodeSubstandard5Helper = + (await encodeSubstandard5Factory.deploy()) as EncodeSubstandard5ForEthers; + } else { + encodeSubstandard5Helper = new ethers.Contract( + ENCODING_HELPER_ANVIL, + EncodeSubstandard5ForEthersABI.abi, + wallet + ) as unknown as EncodeSubstandard5ForEthers; + } + } else if (chain == "sepolia") { + provider = new ethers.JsonRpcProvider(ARB_SEPOLIA_RPC); + wallet = new ethers.Wallet(WALLET_PRIV_KEY as string, provider); + seaport = new Seaport(wallet); + + if (VAULT721_SEPOLIA_ADAPATER_ADDRESS && VAULT721_SEPOLIA_ADDRESS) { + vault721AdapterAddress = VAULT721_SEPOLIA_ADAPATER_ADDRESS; + vault721Address = VAULT721_SEPOLIA_ADDRESS; + } else { + throw new Error("VAULT721_SEPOLIA_ADAPATER_ADDRESS undefined"); + } + + // if no helper exists deploy helper + if (!ENCODING_HELPER) { + const encodeSubstandard5Factory = new ethers.ContractFactory( + EncodeSubstandard5ForEthersABI.abi, + EncodeSubstandard5ForEthersABI.bytecode, + wallet + ); + encodeSubstandard5Helper = + (await encodeSubstandard5Factory.deploy()) as EncodeSubstandard5ForEthers; } else { - throw new Error('unsupported chain'); + encodeSubstandard5Helper = new ethers.Contract( + ENCODING_HELPER, + EncodeSubstandard5ForEthersABI.abi, + wallet + ) as unknown as EncodeSubstandard5ForEthers; } + } else { + throw new Error("unsupported chain"); + } - // TODO: Fill in the token address and token ID of the NFT you want to sell, as well as the price - let considerationTokenAddress: string = ""; - let vaultId: string = "1"; - let listingAmount: string = ethers.parseEther('1').toString(); - const vault721Adapter = new ethers.Contract(VAULT721_SEPOLIA_ADAPATER_ADDRESS!, vault721AdapterABI.abi, wallet) as unknown as Vault721Adapter; - const sip15Zone = new ethers.Contract(SIP15_ZONE_SEPOLIA_ADDRESS!, sip15ZoneABI.abi); + // TODO: Fill in the token address and token ID of the NFT you want to sell, as well as the price + let considerationTokenAddress: string = ""; + let vaultId: string = "1"; + let listingAmount: string = ethers.parseEther("1").toString(); + const vault721Adapter = new ethers.Contract( + vault721AdapterAddress, + vault721AdapterABI.abi, + wallet + ) as unknown as Vault721Adapter; - /** + /** * struct Substandard5Comparison { uint8[] comparisonEnums; address token; @@ -55,65 +110,100 @@ const createSIP15ZoneListing = async (chain: string) => { bytes32[] traitKeys; } */ - const substandard5ComparisonTypeString = - 'Substandard5Comparison(uint8[] comparisonEnums,address token,address traits,uint256 identifier,bytes32[] traitValues,bytes32[] traitKeys)' + const substandard5ComparisonTypeString: readonly string[] = [ + "tuple(uint8[] comparisonEnums,address token,address traits,uint256 identifier,bytes32[] traitValues,bytes32[] traitKeys)", + ]; + const substandard5ComparisonAbi = [ + { + type: "tuple[]", + name: "Substandard5Comparison", + components: [ + { name: "comparisonEnums", type: "uint8[]" }, + { name: "token", type: "address" }, + { name: "traits", type: "address" }, + { name: "identifier", type: "uint256" }, + { name: "traitValues", type: "bytes32[]" }, + { name: "traitKeys", type: "bytes32[]" }, + ], + }, + ]; + const _comparisonEnums: BigNumberish[] = new Uint8Array([4, 5]) as unknown as BigNumberish[]; + const _traitKeys: BytesLike[] = [ + ethers.keccak256(ethers.toUtf8Bytes("DEBT")), + ethers.keccak256(ethers.toUtf8Bytes("COLLATERAL")), + ]; + const _traitValues: BytesLike[] = await vault721Adapter.getTraitValues( + ethers.toBigInt(vaultId), + _traitKeys + ); + console.log(_traitValues); + const substandard5data: any = [ + { + comparisonEnums: _comparisonEnums, + token: VAULT721_SEPOLIA_ADDRESS, + traits: VAULT721_SEPOLIA_ADAPATER_ADDRESS, + identifier: vaultId, + traitValues: _traitValues, + traitKeys: _traitKeys, + }, + ]; - const _comparisonEnums: number[] = [4, 5]; - const _traitKeys: BytesLike[] = [ethers.keccak256(ethers.toUtf8Bytes('DEBT')), ethers.keccak256(ethers.toUtf8Bytes('COLLATERAL'))]; - const _traitValues: BytesLike[] = await vault721Adapter.getTraitValues(ethers.toBigInt(vaultId), _traitKeys); - - const substandard5data = { - comparisonEnums: _comparisonEnums, - token: VAULT721_SEPOLIA_ADDRESS, - traits: VAULT721_SEPOLIA_ADAPATER_ADDRESS, - identifier: vaultId, - traitValues: _traitValues, - traitKeys: _traitKeys - } - //encode data with struct fragment as type - const encodedStruct = ethers.solidityPacked([substandard5ComparisonTypeString], [substandard5data]); - //encode extraData with substandard - const extraData = ethers.solidityPacked(['uint8', 'bytes'], [ethers.toBeHex('0x05'), encodedStruct]); - // get zone hash by hashing extraData - const zoneHash = ethers.keccak256(extraData); - const timeStamp = (await provider.getBlock('latest'))!.timestamp; + //create encoded substandard 5 data with helper + const extraData = await encodeSubstandard5Helper.encodeSubstandard5( + _comparisonEnums, + vault721Address, + vault721AdapterAddress, + vaultId, + _traitValues, + _traitKeys + ); - const createOrderInput: CreateOrderInput = { - offer: [ - { - itemType: ItemType.ERC721, - token: VAULT721_SEPOLIA_ADDRESS!, - identifier: vaultId - }, - ], - consideration: [ - { - token: considerationTokenAddress, - amount: ethers.parseEther(listingAmount).toString() - }, - ], - startTime: timeStamp, - endTime: 10, - zoneHash: zoneHash, - zone: SIP15_ZONE_SEPOLIA_ADDRESS, - restrictedByZone: true, - } + // get zone hash by hashing extraData + const zoneHash = ethers.keccak256(extraData); + const timeStamp = (await provider.getBlock("latest"))!.timestamp; - try { - const { executeAllActions } = await seaport.createOrder(createOrderInput, wallet.address); - const order = await executeAllActions(); - console.log("Successfully created a listing with orderHash:", order.parameters); - } catch (error) { - console.error("Error in createListing:", error); - } -} + const createOrderInput: CreateOrderInput = { + offer: [ + { + itemType: ItemType.ERC721, + token: VAULT721_SEPOLIA_ADDRESS!, + identifier: vaultId, + }, + ], + consideration: [ + { + token: considerationTokenAddress, + amount: ethers.parseEther(listingAmount).toString(), + }, + ], + startTime: timeStamp, + endTime: 10, + zoneHash: zoneHash, + zone: SIP15_ZONE_SEPOLIA_ADDRESS, + restrictedByZone: true, + }; + + try { + const { executeAllActions } = await seaport.createOrder( + createOrderInput, + wallet.address + ); + const order = await executeAllActions(); + console.log( + "Successfully created a listing with orderHash:", + order.parameters + ); + } catch (error) { + console.error("Error in createListing:", error); + } +}; // Check if the module is the main entry point if (require.main === module) { - // If yes, run the createOffer function - createSIP15ZoneListing('sepolia').catch((error) => { - console.error("Error in createListing:", error); - }); + // If yes, run the createOffer function + createSIP15ZoneListing("anvil").catch((error) => { + console.error("Error in createListing:", error); + }); } -export default createSIP15ZoneListing; \ No newline at end of file +export default createSIP15ZoneListing; diff --git a/script/utils/EncodeSubstandard5ForEthers.sol b/script/utils/EncodeSubstandard5ForEthers.sol new file mode 100644 index 0000000..20507a7 --- /dev/null +++ b/script/utils/EncodeSubstandard5ForEthers.sol @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.24; +import {SIP15Encoder, Substandard5Comparison} from "../../src/sips/SIP15Encoder.sol"; + +contract EncodeSubstandard5ForEthers { + using SIP15Encoder for bytes; + + constructor() {} + + function encodeSubstandard5( + uint8[] memory comparisonEnums, + address token, + address traits, + uint256 identifier, + bytes32[] memory traitValues, + bytes32[] memory traitKeys + ) public pure returns (bytes memory) { + Substandard5Comparison memory newComparison = Substandard5Comparison({ + comparisonEnums: comparisonEnums, + token: token, + traits: traits, + identifier: identifier, + traitValues: traitValues, + traitKeys: traitKeys + }); + return SIP15Encoder.encodeSubstandard5(newComparison); + } +} diff --git a/script/utils/constants.ts b/script/utils/constants.ts index c082787..dde2155 100644 --- a/script/utils/constants.ts +++ b/script/utils/constants.ts @@ -5,11 +5,15 @@ export const OPENSEA_API_KEY = process.env.OPENSEA_API_KEY; export const WALLET_PRIV_KEY = process.env.ARB_SEPOLIA_PK; export const ARB_SEPOLIA_RPC = process.env.ARB_SEPOLIA_RPC; export const SIP15_ZONE_SEPOLIA_ADDRESS = process.env.SIP15_ZONE_SEPOLIA_ADDRESS; +export const SIP15_ZONE_ANVIL_ADDRESS = process.env.SIP15_ZONE_ANVIL_ADDRESS; export const VAULT721_SEPOLIA_ADAPATER_ADDRESS = process.env.VAULT721_SEPOLIA_ADAPATER_ADDRESS; +export const VAULT721_ANVIL_ADAPATER_ADDRESS = process.env.VAULT721_ANVIL_ADAPATER_ADDRESS; export const VAULT721_SEPOLIA_ADDRESS = process.env.VAULT721_SEPOLIA_ADDRESS; +export const VAULT721_ANVIL_ADDRESS = process.env.VAULT721_ANVIL_ADDRESS; export const ANVIL_ONE = process.env.ANVIL_ONE; export const ANVIL_RPC = process.env.ANVIL_RPC; - +export const ENCODING_HELPER = process.env.ENCODING_HELPER; +export const ENCODING_HELPER_ANVIL = process.env.ENCODING_HELPER_ANVIL; export const sepoliaProvider = new JsonRpcProvider(ARB_SEPOLIA_RPC); export const sepoliaWallet = new ethers.Wallet( diff --git a/test/unit/SIP15Encoder.t.sol b/test/unit/SIP15Encoder.t.sol index f259998..d01f2d3 100644 --- a/test/unit/SIP15Encoder.t.sol +++ b/test/unit/SIP15Encoder.t.sol @@ -2,7 +2,7 @@ pragma solidity 0.8.24; import {Test, console} from 'forge-std/Test.sol'; -import {SIP15Encoder} from '../../src/sips/SIP15Encoder.sol'; +import {SIP15Encoder, Substandard5Comparison} from '../../src/sips/SIP15Encoder.sol'; import {ZoneParameters, Schema} from 'seaport-types/src/lib/ConsiderationStructs.sol'; import { ConsiderationItemLib, @@ -113,6 +113,17 @@ contract SIP15Encoder_Unit_test is Test { ); } + function test_EncodeSubstandarad5(Context memory context) public { + this.encodeSubstandard5( + context.fuzzInputs.comparisonEnum, + context.fuzzInputs.token, + context.fuzzInputs.token2, + context.fuzzInputs.tokenId, + context.fuzzInputs.traitValue, + context.fuzzInputs.traitKey + ); + } + function encodeSubstandard1Efficient(ZoneParameters calldata zoneParams, bytes32 _traitKey) public { bytes memory encodedData = SIP15Encoder.encodeSubstandard1Efficient(zoneParams, _traitKey); uint8 substandard = uint8(this.decodeSubstandardVersion(encodedData, 0)); @@ -194,6 +205,49 @@ contract SIP15Encoder_Unit_test is Test { assertEq(identifier, _identifier); } + function encodeSubstandard5( + uint8 _comparisonEnum, + address _token, + address _traits, + uint256 _identifier, + bytes32 _traitValue, + bytes32 _traitKey + ) public view { + uint8[] memory _compEnums = new uint8[](2); + _compEnums[0] = _comparisonEnum; + _compEnums[1] = 69; + bytes32[] memory _traitValues = new bytes32[](2); + _traitValues[0] = _traitValue; + _traitValues[1] = bytes32(uint256(69)); + + bytes32[] memory _traitKeys = new bytes32[](2); + _traitKeys[0] = _traitKey; + _traitKeys[1] = bytes32(uint256(420)); + + + + Substandard5Comparison memory comparison = Substandard5Comparison({ + comparisonEnums: _compEnums, token: _token, traits: _traits, identifier: _identifier, + traitValues: _traitValues, traitKeys: _traitKeys + }); + bytes memory encodedData = + SIP15Encoder.encodeSubstandard5(comparison); + uint8 substandard = uint8(this.decodeSubstandardVersion(encodedData, 0)); + console.log(substandard); + console.log('encoded data'); + console.logBytes(encodedData); + bytes memory trimmedData = this.trimSubstandard(encodedData); + (Substandard5Comparison memory returnComp) = + abi.decode(trimmedData, (Substandard5Comparison)); + + assertEq(substandard, 5); + assertEq(returnComp.comparisonEnums[0], _comparisonEnum); + assertEq(returnComp.traitKeys[0], _traitKey); + assertEq(returnComp.traitValues[0], _traitValue); + assertEq(returnComp.token, _token); + assertEq(returnComp.identifier, _identifier); + } + function trimSubstandard(bytes calldata dataToTrim) external pure returns (bytes memory data) { data = dataToTrim[1:]; } diff --git a/types/ethers-contracts/EncodeSubstandard5ForEthers.ts b/types/ethers-contracts/EncodeSubstandard5ForEthers.ts new file mode 100644 index 0000000..92c41e8 --- /dev/null +++ b/types/ethers-contracts/EncodeSubstandard5ForEthers.ts @@ -0,0 +1,121 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BigNumberish, + BytesLike, + FunctionFragment, + Result, + Interface, + AddressLike, + ContractRunner, + ContractMethod, + Listener, +} from "ethers"; +import type { + TypedContractEvent, + TypedDeferredTopicFilter, + TypedEventLog, + TypedListener, + TypedContractMethod, +} from "./common"; + +export interface EncodeSubstandard5ForEthersInterface extends Interface { + getFunction(nameOrSignature: "encodeSubstandard5"): FunctionFragment; + + encodeFunctionData( + functionFragment: "encodeSubstandard5", + values: [ + BigNumberish[], + AddressLike, + AddressLike, + BigNumberish, + BytesLike[], + BytesLike[] + ] + ): string; + + decodeFunctionResult( + functionFragment: "encodeSubstandard5", + data: BytesLike + ): Result; +} + +export interface EncodeSubstandard5ForEthers extends BaseContract { + connect(runner?: ContractRunner | null): EncodeSubstandard5ForEthers; + waitForDeployment(): Promise; + + interface: EncodeSubstandard5ForEthersInterface; + + queryFilter( + event: TCEvent, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + queryFilter( + filter: TypedDeferredTopicFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + + on( + event: TCEvent, + listener: TypedListener + ): Promise; + on( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + once( + event: TCEvent, + listener: TypedListener + ): Promise; + once( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + listeners( + event: TCEvent + ): Promise>>; + listeners(eventName?: string): Promise>; + removeAllListeners( + event?: TCEvent + ): Promise; + + encodeSubstandard5: TypedContractMethod< + [ + comparisonEnums: BigNumberish[], + token: AddressLike, + traits: AddressLike, + identifier: BigNumberish, + traitValues: BytesLike[], + traitKeys: BytesLike[] + ], + [string], + "view" + >; + + getFunction( + key: string | FunctionFragment + ): T; + + getFunction( + nameOrSignature: "encodeSubstandard5" + ): TypedContractMethod< + [ + comparisonEnums: BigNumberish[], + token: AddressLike, + traits: AddressLike, + identifier: BigNumberish, + traitValues: BytesLike[], + traitKeys: BytesLike[] + ], + [string], + "view" + >; + + filters: {}; +} diff --git a/types/ethers-contracts/factories/EncodeSubstandard5ForEthers__factory.ts b/types/ethers-contracts/factories/EncodeSubstandard5ForEthers__factory.ts new file mode 100644 index 0000000..408fb1a --- /dev/null +++ b/types/ethers-contracts/factories/EncodeSubstandard5ForEthers__factory.ts @@ -0,0 +1,122 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import { + Contract, + ContractFactory, + ContractTransactionResponse, + Interface, +} from "ethers"; +import type { Signer, ContractDeployTransaction, ContractRunner } from "ethers"; +import type { NonPayableOverrides } from "../common"; +import type { + EncodeSubstandard5ForEthers, + EncodeSubstandard5ForEthersInterface, +} from "../EncodeSubstandard5ForEthers"; + +const _abi = [ + { + type: "constructor", + inputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "encodeSubstandard5", + inputs: [ + { + name: "comparisonEnums", + type: "uint8[]", + internalType: "uint8[]", + }, + { + name: "token", + type: "address", + internalType: "address", + }, + { + name: "traits", + type: "address", + internalType: "address", + }, + { + name: "identifier", + type: "uint256", + internalType: "uint256", + }, + { + name: "traitValues", + type: "bytes32[]", + internalType: "bytes32[]", + }, + { + name: "traitKeys", + type: "bytes32[]", + internalType: "bytes32[]", + }, + ], + outputs: [ + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + stateMutability: "pure", + }, +] as const; + +const _bytecode = + "0x608060405234801561000f575f80fd5b506104ac8061001d5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063d0a871751461002d575b5f80fd5b61004061003b3660046101e7565b610056565b60405161004d9190610318565b60405180910390f35b60605f6040518060c00160405280898152602001886001600160a01b03168152602001876001600160a01b031681526020018681526020018581526020018481525090506100a3816100af565b98975050505050505050565b60606005826040516020016100c49190610384565b60408051601f19818403018152908290526100e29291602001610448565b6040516020818303038152906040529050919050565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610135576101356100f8565b604052919050565b5f67ffffffffffffffff821115610156576101566100f8565b5060051b60200190565b80356001600160a01b0381168114610176575f80fd5b919050565b5f82601f83011261018a575f80fd5b8135602061019f61019a8361013d565b61010c565b8083825260208201915060208460051b8701019350868411156101c0575f80fd5b602086015b848110156101dc57803583529183019183016101c5565b509695505050505050565b5f805f805f8060c087890312156101fc575f80fd5b863567ffffffffffffffff80821115610213575f80fd5b818901915089601f830112610226575f80fd5b8135602061023661019a8361013d565b82815260059290921b8401810191818101908d841115610254575f80fd5b948201945b8386101561028057853560ff81168114610271575f80fd5b82529482019490820190610259565b9a5061028f90508b8201610160565b9850505061029f60408a01610160565b95506060890135945060808901359150808211156102bb575f80fd5b6102c78a838b0161017b565b935060a08901359150808211156102dc575f80fd5b506102e989828a0161017b565b9150509295509295509295565b5f5b838110156103105781810151838201526020016102f8565b50505f910152565b602081525f82518060208401526103368160408501602087016102f6565b601f01601f19169190910160400192915050565b5f815180845260208085019450602084015f5b838110156103795781518752958201959082019060010161035d565b509495945050505050565b6020808252825160c083830152805160e084018190525f929182019083906101008601905b808310156103cc57835160ff1682529284019260019290920191908401906103a9565b50928601516001600160a01b03811660408701529260408701516001600160a01b038116606088015293506060870151608087015260808701519350601f199250828682030160a0870152610421818561034a565b9350505060a0850151818584030160c086015261043e838261034a565b9695505050505050565b60ff60f81b8360f81b1681525f82516104688160018501602087016102f6565b91909101600101939250505056fea264697066735822122023956235668f9ec4be55d2e194eb1372e50490597c19ad9f319d2e0f29e0157064736f6c63430008180033"; + +type EncodeSubstandard5ForEthersConstructorParams = + | [signer?: Signer] + | ConstructorParameters; + +const isSuperArgs = ( + xs: EncodeSubstandard5ForEthersConstructorParams +): xs is ConstructorParameters => xs.length > 1; + +export class EncodeSubstandard5ForEthers__factory extends ContractFactory { + constructor(...args: EncodeSubstandard5ForEthersConstructorParams) { + if (isSuperArgs(args)) { + super(...args); + } else { + super(_abi, _bytecode, args[0]); + } + } + + override getDeployTransaction( + overrides?: NonPayableOverrides & { from?: string } + ): Promise { + return super.getDeployTransaction(overrides || {}); + } + override deploy(overrides?: NonPayableOverrides & { from?: string }) { + return super.deploy(overrides || {}) as Promise< + EncodeSubstandard5ForEthers & { + deploymentTransaction(): ContractTransactionResponse; + } + >; + } + override connect( + runner: ContractRunner | null + ): EncodeSubstandard5ForEthers__factory { + return super.connect(runner) as EncodeSubstandard5ForEthers__factory; + } + + static readonly bytecode = _bytecode; + static readonly abi = _abi; + static createInterface(): EncodeSubstandard5ForEthersInterface { + return new Interface(_abi) as EncodeSubstandard5ForEthersInterface; + } + static connect( + address: string, + runner?: ContractRunner | null + ): EncodeSubstandard5ForEthers { + return new Contract( + address, + _abi, + runner + ) as unknown as EncodeSubstandard5ForEthers; + } +} diff --git a/types/ethers-contracts/factories/index.ts b/types/ethers-contracts/factories/index.ts index c27a1ad..733e9cc 100644 --- a/types/ethers-contracts/factories/index.ts +++ b/types/ethers-contracts/factories/index.ts @@ -1,4 +1,4 @@ /* Autogenerated file. Do not edit manually. */ /* tslint:disable */ /* eslint-disable */ -export { Vault721Adapter__factory } from "./Vault721Adapter__factory"; +export { EncodeSubstandard5ForEthers__factory } from "./EncodeSubstandard5ForEthers__factory"; diff --git a/types/ethers-contracts/index.ts b/types/ethers-contracts/index.ts index c138a33..f9e234c 100644 --- a/types/ethers-contracts/index.ts +++ b/types/ethers-contracts/index.ts @@ -1,6 +1,8 @@ /* Autogenerated file. Do not edit manually. */ /* tslint:disable */ /* eslint-disable */ +export type { EncodeSubstandard5ForEthers } from "./EncodeSubstandard5ForEthers"; export type { Vault721Adapter } from "./Vault721Adapter"; export * as factories from "./factories"; +export { EncodeSubstandard5ForEthers__factory } from "./factories/EncodeSubstandard5ForEthers__factory"; export { Vault721Adapter__factory } from "./factories/Vault721Adapter__factory";