From 25838c738c5a50a9f4aaf5b33423ea0f1cd1c7a0 Mon Sep 17 00:00:00 2001 From: Kai Kang Date: Fri, 22 Mar 2024 18:03:20 +0800 Subject: [PATCH] ADD: aime contract v2 --- contracts/aime/AIMeFactoryV2.sol | 130 ++++++++++++ contracts/aime/AIMeNFTV2.sol | 315 ++++++++++++++++++++++++++++ contracts/example/ERC314.sol | 349 +++++++++++++++++++++++++++++++ hardhat.config.ts | 5 +- package.json | 2 +- scripts/aime/deploy_aime.ts | 8 +- 6 files changed, 803 insertions(+), 6 deletions(-) create mode 100644 contracts/aime/AIMeFactoryV2.sol create mode 100644 contracts/aime/AIMeNFTV2.sol create mode 100644 contracts/example/ERC314.sol diff --git a/contracts/aime/AIMeFactoryV2.sol b/contracts/aime/AIMeFactoryV2.sol new file mode 100644 index 0000000..8f04d21 --- /dev/null +++ b/contracts/aime/AIMeFactoryV2.sol @@ -0,0 +1,130 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.2 <0.9.0; + +import "./AIMeNFTV2.sol"; +import "@openzeppelin/contracts/access/Ownable.sol"; +import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; +import "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol"; + +contract AIMeFactoryV2 is Ownable { + uint256 public protocolFee = 0.001 ether; // create fee * 10 + + constructor() Ownable(msg.sender) {} + + event AIMeCreated(address creator, address aimeAddress); + event AIMeNFTMinted( + address creator, + address aimeAddress, + uint256 tokenId, + string key, + string infoType, + string data, + uint256 amount + ); + event AIMePowerWithdraw(address aimeAddress, address to, uint256 amount); + event Received(address sender, uint amount); + + mapping(address => uint256) public addressNonce; + mapping(address => address) public aimeSigners; + mapping(string => address) public aimeAddresses; + + function _genMessageHash( + address creatorAddress, + address aimeAddress, + uint256 tokenId, + string memory key, + string memory dataType, + string memory data, + string memory image, + uint256 amount, + uint256 nonce + ) private pure returns (bytes32) { + return + keccak256( + abi.encodePacked( + creatorAddress, + aimeAddress, + tokenId, + key, + dataType, + data, + image, + amount, + nonce + ) + ); + } + + function createAIME( + string memory name_, + string memory avatar_, + string memory bio_, + string memory image_, + address aimeSigner + ) public payable { + require(msg.value >= protocolFee * 10, "Insufficient payment"); + require(aimeAddresses[name_] == address(0), "AIME already exists"); + AIMeNFTV2 aime = new AIMeNFTV2(string(abi.encodePacked("AIME:", name_)), name_, avatar_, bio_, image_); + address payable aimeAddress = payable(address(aime)); + aimeAddresses[name_] = aimeAddress; + aimeSigners[aimeAddress] = aimeSigner; + (bool success, ) = aimeAddress.call{value: msg.value}(""); + require(success, "Failed to send Ether"); + emit AIMeCreated(msg.sender, address(aime)); + } + + function mintAIMeNFT( + address payable aimeAddress, + string memory key, + string memory dataType, + string memory data, + string memory image, + uint256 amount, + bytes memory signature + ) public payable { + require(msg.value >= protocolFee, "Insufficient payment"); + address signer = aimeSigners[aimeAddress]; + if (signer != address(0)) { + bytes32 _msgHash = MessageHashUtils.toEthSignedMessageHash( + _genMessageHash(msg.sender, aimeAddress, 0, key, dataType, data, image, amount, addressNonce[msg.sender]) + ); + require(ECDSA.recover(_msgHash, signature) == signer, "Invalid signature"); + addressNonce[msg.sender] += 1; + } + + AIMeNFTV2 aime = AIMeNFTV2(aimeAddress); + uint256 tokenId = aime.safeMint(msg.sender, key, dataType, data, image, amount); + + (bool success, ) = aimeAddress.call{value: msg.value}(""); + require(success, "Failed to send Ether"); + + emit AIMeNFTMinted( + msg.sender, + aimeAddress, + tokenId, + key, + dataType, + data, + amount + ); + } + + // todo: update NFT data + + function withdrawPowers(address payable aimeAddress, uint256 amount, bytes memory signature) public { + // todo: validate signature + AIMeNFTV2 aime = AIMeNFTV2(aimeAddress); + aime.withdrawPowers(msg.sender, amount); + emit AIMePowerWithdraw(aimeAddress, msg.sender, amount); + } + + function withdrawFee() public onlyOwner { + uint amount = address(this).balance; + (bool success, ) = owner().call{value: amount}(""); + require(success, "Failed to send Ether"); + } + + receive() external payable { + emit Received(msg.sender, msg.value); + } +} diff --git a/contracts/aime/AIMeNFTV2.sol b/contracts/aime/AIMeNFTV2.sol new file mode 100644 index 0000000..35c6379 --- /dev/null +++ b/contracts/aime/AIMeNFTV2.sol @@ -0,0 +1,315 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.2 <0.9.0; + +import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; +import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol"; +import "@openzeppelin/contracts/access/Ownable.sol"; +import "@openzeppelin/contracts/utils/Base64.sol"; +import "@openzeppelin/contracts/utils/Strings.sol"; +import "./AIMePower.sol"; + +contract AIMeNFTV2 is ERC721, Ownable, ERC721Holder { + uint256 public constant AIME_POWER_TOTAL_AMOUNT = 1000000 * 1e18; + uint256 public constant AIME_POWER_SWAP_INIT_AMOUNT = 100000 * 1e18; + uint256 public constant AIME_NFT_PRICE_FACTOR = 12; + uint256 public constant AIME_POWER_TRADE_MIN_AMOUNT = 0.0001 * 1e18; + uint256 public constant NFT_HOLDING_PERIOD = 30 days; + uint256 public aimePowerReserved; + uint256 public swapPowerBalance; + address public aimePowerAddress; + string public avatar; + address private _factory; + using Strings for uint256; + uint256 private _nextTokenId; + mapping(uint256 => AIMeInfo) public tokenContents; + + mapping(address => uint256) public powerBalance; + + error AIMeNFTUnauthorizedAccount(address account); + event Trade( + address trader, + bool isBuy, + uint256 powerAmount, + uint256 priceAfterFee, + uint256 fee, + uint256 supply + ); + + event TradeNFT(address from, address to, uint256 tokenId, uint256 price); + + event Received(address sender, uint amount); + + modifier onlyFactory() { + if (factory() != _msgSender()) { + revert AIMeNFTUnauthorizedAccount(_msgSender()); + } + _; + } + + struct AIMeInfo { + string key; + string dataType; + string data; + string image; + uint256 amount; + uint256 currentAmount; + uint256 timestamp; + } + + constructor( + string memory name_, + string memory symbol_, + string memory avatar_, + string memory bio_, + string memory image_ + ) ERC721(name_, symbol_) Ownable(msg.sender) { + _factory = _msgSender(); + AIMePower aimePower = new AIMePower(name_, symbol_); + aimePowerAddress = address(aimePower); + aimePower.mint(address(this), AIME_POWER_TOTAL_AMOUNT); + + swapPowerBalance = AIME_POWER_SWAP_INIT_AMOUNT; + aimePowerReserved = + AIME_POWER_TOTAL_AMOUNT - + AIME_POWER_SWAP_INIT_AMOUNT; + + avatar = avatar_; + + // mint initial nft + safeMint(address(this), "basic_prompt", "static", bio_, image_, 0); + } + + function factory() public view virtual returns (address) { + return _factory; + } + + function getAmountOut( + uint256 value, + bool _buy + ) public view returns (uint256) { + uint256 ethBalance = address(this).balance; + if (_buy) { + return (swapPowerBalance * value) / (ethBalance + value); + } else { + return (ethBalance * value) / (swapPowerBalance + value); + } + } + + function getAmountIn( + uint256 value, + bool _buy + ) public view returns (uint256) { + uint256 ethBalance = address(this).balance; + if (_buy) { + return (ethBalance * value) / (swapPowerBalance - value); + } else { + return (swapPowerBalance * value) / (ethBalance - value); + } + } + + function getBuyPrice(uint256 amount) public view returns (uint256) { + return getAmountIn(amount, true); + } + + function getSellPrice(uint256 amount) public view returns (uint256) { + return getAmountOut(amount, false); + } + + function buyPowers(uint256 amount) public payable { + // eth amount + uint256 ethAmount = ((address(this).balance - msg.value) * amount) / (swapPowerBalance - amount); + require(msg.value == ethAmount, "Incorrect payment"); + + // transfer power to user + // store power in contract for AI fee + powerBalance[msg.sender] += amount; + // AIMePower power = AIMePower(aimePowerAddress); + // power.transfer(msg.sender, amount); + swapPowerBalance -= amount; + emit Trade(msg.sender, true, amount, ethAmount, 0, 0); + } + + function sellPowers(uint256 amount) public { + // transfer power from user + // todo: transfer token without approve? + AIMePower power = AIMePower(aimePowerAddress); + require(power.balanceOf(msg.sender) >= amount, "balance not enough"); + require( + power.allowance(msg.sender, address(this)) >= amount, + "allowance not enough" + ); + + // eth amount + uint256 ethAmount = getAmountOut(amount, false); + require(ethAmount > 0, "Amount too small"); + require(address(this).balance >= ethAmount, "Insufficient ETH balance"); + + // transfer power + power.transferFrom(msg.sender, address(this), amount); + swapPowerBalance += amount; + + // transfer eth to user + (bool success, ) = msg.sender.call{value: ethAmount}(""); + require(success, "Unable to send funds"); + + emit Trade(msg.sender, false, amount, ethAmount, 0, 0); + } + + function withdrawPowers(address to, uint256 amount) public onlyFactory() { + require(powerBalance[to] >= amount, "Insufficient Power balance"); + powerBalance[to] -= amount; + AIMePower power = AIMePower(aimePowerAddress); + power.transfer(to, amount); + } + + function safeMint( + address to, + string memory key, + string memory dataType, + string memory data, + string memory image, + uint256 amount + ) public onlyFactory returns (uint256) { + uint256 tokenId = _nextTokenId++; + _safeMint(to, tokenId); + tokenContents[tokenId] = AIMeInfo( + key, + dataType, + data, + image, + amount, + amount, + block.timestamp + ); + aimePowerReserved -= amount; + return tokenId; + } + + function updateAIMeInfo( + uint256 tokenId, + address owner, + string memory data, + string memory image + ) public onlyFactory { + address tokenOwner = _ownerOf(tokenId); + require( + tokenOwner == owner && owner != address(0), + "Invalid token owner" + ); + tokenContents[tokenId].data = data; + tokenContents[tokenId].image = image; + tokenContents[tokenId].timestamp = block.timestamp; + } + + function sellNFT(uint256 tokenId) external { + _safeTransfer(msg.sender, address(this), tokenId); + + uint256 duration = block.timestamp - tokenContents[tokenId].timestamp; + uint256 amount; + + if (duration < NFT_HOLDING_PERIOD) { + amount = duration / NFT_HOLDING_PERIOD; + } else { + amount = tokenContents[tokenId].amount; + } + + // store user's power in contract + powerBalance[msg.sender] += amount; + // AIMePower power = AIMePower(aimePowerAddress); + // power.transfer(msg.sender, amount); + emit TradeNFT(msg.sender, address(this), tokenId, amount); + } + + function buyNFT(uint256 tokenId) external { + require(tokenId != 0, "Cannot buy the first NFT"); + AIMePower power = AIMePower(aimePowerAddress); + address owner = _requireOwned(tokenId); + uint256 amount; + if (owner == address(this)) { + amount = tokenContents[tokenId].amount; + } else { + amount = + (tokenContents[tokenId].currentAmount * AIME_NFT_PRICE_FACTOR) / + 10; + tokenContents[tokenId].currentAmount = amount; + } + + require(power.balanceOf(msg.sender) >= amount, "balance not enough"); + require( + power.allowance(msg.sender, address(this)) >= amount, + "allowance not enough" + ); + + // store user's power in contract + if (owner != address(this)) { + powerBalance[owner] += amount; + } else { + power.transferFrom(msg.sender, owner, amount); + } + + _safeTransfer(owner, msg.sender, tokenId); + tokenContents[tokenId].timestamp = block.timestamp; + emit TradeNFT(owner, msg.sender, tokenId, amount); + } + + function tokenURI( + uint256 tokenId + ) public view virtual override returns (string memory) { + _requireOwned(tokenId); + + string memory tokenName = string( + abi.encodePacked( + name(), + " #", + tokenId.toString() + ) + ); + string memory imageUrl = tokenContents[tokenId].image; + string memory tradeUrl = string( + abi.encodePacked( + "https://app.aime.bot/nft/", + Strings.toHexString(uint256(uint160(address(this))), 20), + "/", + tokenId.toString() + ) + ); + + string memory attributes = string( + abi.encodePacked( + '[', + '{"trait_type": "type","value": "',tokenContents[tokenId].dataType,'"},', + '{"trait_type": "key","value": "',tokenContents[tokenId].key,'"},', + '{"trait_type": "data","value": "',tokenContents[tokenId].data,'"}', + ']' + ) + ); + + string memory json = Base64.encode( + bytes( + string( + abi.encodePacked( + '{"name": "', tokenName, + '", "description": "A block of content of ', + name(), + ". Trade at: ", + tradeUrl, + '", "attributes":', attributes,', "amount": "', + tokenContents[tokenId].amount.toString(), + '", "image": "', + imageUrl, + '"}' + ) + ) + ) + ); + string memory output = string( + abi.encodePacked("data:application/json;base64,", json) + ); + + return output; + } + + receive() external payable { + emit Received(msg.sender, msg.value); + } +} diff --git a/contracts/example/ERC314.sol b/contracts/example/ERC314.sol new file mode 100644 index 0000000..f5f9779 --- /dev/null +++ b/contracts/example/ERC314.sol @@ -0,0 +1,349 @@ +/** + *Submitted for verification at Etherscan.io on 2024-03-20 +*/ + +// SPDX-License-Identifier: MIT + +//https://linktr.ee/simplifyerc + +pragma solidity ^0.8.20; + + +/** + * @title ERC314 + * @dev Implementation of the ERC314 interface. + * ERC314 is a derivative of ERC20 which aims to integrate a liquidity pool on the token in order to enable native swaps, notably to reduce gas consumption. + */ + +// Events interface for ERC314 +interface IEERC314 { + event Transfer(address indexed from, address indexed to, uint256 value); + event AddLiquidity(uint32 _blockToUnlockLiquidity, uint256 value); + event RemoveLiquidity(uint256 value); + event Swap( + address indexed sender, + uint amount0In, + uint amount1In, + uint amount0Out, + uint amount1Out + ); +} + + +abstract contract ERC314 is IEERC314{ + mapping(address account => uint256) private _balances; + + uint256 private _totalSupply; + uint256 public _maxWallet; + uint32 public blockToUnlockLiquidity; + + string private _name; + string private _symbol; + + address public owner; + address public liquidityProvider; + + bool public tradingEnable; + bool public liquidityAdded; + bool public maxWalletEnable; + + uint256 presaleAmount; + + bool public presaleEnable = false; + + mapping(address account => uint32) private lastTransaction; + + + modifier onlyOwner() { + require(msg.sender == owner, "Ownable: caller is not the owner"); + _; + } + + modifier onlyLiquidityProvider() { + require(msg.sender == liquidityProvider, "You are not the liquidity provider"); + _; + } + + /** + * @dev Sets the values for {name}, {symbol} and {totalSupply}. + * + * All two of these values are immutable: they can only be set once during + * construction. + */ + constructor(string memory name_, string memory symbol_, uint256 totalSupply_) { + _name = name_; + _symbol = symbol_; + _totalSupply = totalSupply_; + _maxWallet = totalSupply_ / 200; + owner = msg.sender; + tradingEnable = false; + maxWalletEnable = true; + _balances[msg.sender] = totalSupply_/10; + presaleAmount = (totalSupply_ - _balances[msg.sender]) / 2; + uint256 liquidityAmount = totalSupply_ - presaleAmount - _balances[msg.sender]; + _balances[address(this)] = liquidityAmount; + liquidityAdded = false; + + } + + /** + * @dev Sends the presale amount to the investors + */ + function presale(address[] memory _investors) public onlyOwner { + require(presaleEnable == false, "Presale already enabled"); + uint256 _amount = presaleAmount / _investors.length; + for (uint256 i = 0; i < _investors.length; i++) { + _balances[_investors[i]] += _amount; + } + presaleEnable = true; + } + + /** + * @dev Returns the name of the token. + */ + function name() public view virtual returns (string memory) { + return _name; + } + + /** + * @dev Returns the symbol of the token, usually a shorter version of the + * name. + */ + function symbol() public view virtual returns (string memory) { + return _symbol; + } + + + /** + * @dev Returns the number of decimals used to get its user representation. + */ + + function decimals() public view virtual returns (uint8) { + return 18; + } + + /** + * @dev See {IERC20-totalSupply}. + */ + function totalSupply() public view virtual returns (uint256) { + return _totalSupply; + } + + /** + * @dev See {IERC20-balanceOf}. + */ + function balanceOf(address account) public view virtual returns (uint256) { + return _balances[account]; + } + + /** + * @dev See {IERC20-transfer}. + * + * Requirements: + * + * - the caller must have a balance of at least `value`. + * - if the receiver is the contract, the caller must send the amount of tokens to sell + */ + function transfer(address to, uint256 value) public virtual returns (bool) { + // sell or transfer + if (to == address(this)) { + sell(value); + } + else{ + _transfer(msg.sender, to, value); + } + return true; + } + + /** + * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively burns if `to` is the zero address. + * All customizations to transfers and burns should be done by overriding this function. + * This function includes MEV protection, which prevents the same address from making two transactions in the same block.(lastTransaction) + * Emits a {Transfer} event. + */ + function _transfer(address from, address to, uint256 value) internal virtual { + + require(lastTransaction[msg.sender] != block.number, "You can't make two transactions in the same block"); + + lastTransaction[msg.sender] = uint32(block.number); + + require (_balances[from] >= value, "ERC20: transfer amount exceeds balance"); + + unchecked { + _balances[from] = _balances[from] - value; + } + + if (to == address(0)) { + unchecked { + _totalSupply -= value; + } + } else { + unchecked { + _balances[to] += value; + } + } + + emit Transfer(from, to, value); + } + + /** + * @dev Returns the amount of ETH and tokens in the contract, used for trading. + */ + function getReserves() public view returns (uint256, uint256) { + return (address(this).balance, _balances[address(this)]); + } + + /** + * @dev Enables or disables trading. + * @param _tradingEnable: true to enable trading, false to disable trading. + * onlyOwner modifier + */ + function enableTrading(bool _tradingEnable) external onlyOwner { + tradingEnable = _tradingEnable; + } + + /** + * @dev Enables or disables the max wallet. + * @param _maxWalletEnable: true to enable max wallet, false to disable max wallet. + * onlyOwner modifier + */ + function enableMaxWallet(bool _maxWalletEnable) external onlyOwner { + maxWalletEnable = _maxWalletEnable; + } + + /** + * @dev Sets the max wallet. + * @param _maxWallet_: the new max wallet. + * onlyOwner modifier + */ + function setMaxWallet(uint256 _maxWallet_) external onlyOwner { + _maxWallet = _maxWallet_; + } + + /** + * @dev Transfers the ownership of the contract to zero address + * onlyOwner modifier + */ + function renounceOwnership() external onlyOwner { + owner = address(0); + } + + /** + * @dev Adds liquidity to the contract. + * @param _blockToUnlockLiquidity: the block number to unlock the liquidity. + * value: the amount of ETH to add to the liquidity. + * onlyOwner modifier + */ + function addLiquidity(uint32 _blockToUnlockLiquidity) public onlyOwner payable { + + require(liquidityAdded == false, "Liquidity already added"); + + liquidityAdded = true; + + require(msg.value > 0, "No ETH sent"); + require(block.number < _blockToUnlockLiquidity, "Block number too low"); + + blockToUnlockLiquidity = _blockToUnlockLiquidity; + tradingEnable = true; + liquidityProvider = msg.sender; + + emit AddLiquidity(_blockToUnlockLiquidity, msg.value); + } + + /** + * @dev Removes liquidity from the contract. + * onlyLiquidityProvider modifier + */ + function removeLiquidity() public onlyLiquidityProvider { + + require(block.number > blockToUnlockLiquidity, "Liquidity locked"); + + tradingEnable = false; + + payable(msg.sender).transfer(address(this).balance); + + emit RemoveLiquidity(address(this).balance); + + } + + /** + * @dev Extends the liquidity lock, only if the new block number is higher than the current one. + * @param _blockToUnlockLiquidity: the new block number to unlock the liquidity. + * onlyLiquidityProvider modifier + */ + function extendLiquidityLock(uint32 _blockToUnlockLiquidity) public onlyLiquidityProvider { + + require(blockToUnlockLiquidity < _blockToUnlockLiquidity, "You can't shorten duration"); + + blockToUnlockLiquidity = _blockToUnlockLiquidity; + } + + /** + * @dev Estimates the amount of tokens or ETH to receive when buying or selling. + * @param value: the amount of ETH or tokens to swap. + * @param _buy: true if buying, false if selling. + */ + function getAmountOut(uint256 value, bool _buy) public view returns(uint256) { + + (uint256 reserveETH, uint256 reserveToken) = getReserves(); + + if (_buy) { + return (value * reserveToken) / (reserveETH + value); + } else { + return (value * reserveETH) / (reserveToken + value); + } + } + + /** + * @dev Buys tokens with ETH. + * internal function + */ + function buy() internal { + + require(tradingEnable, "Trading not enable"); + + uint256 token_amount = (msg.value * _balances[address(this)]) / (address(this).balance); + + if (maxWalletEnable) { + require(token_amount + _balances[msg.sender] <= _maxWallet, "Max wallet exceeded"); + } + + _transfer(address(this), msg.sender, token_amount); + + emit Swap(msg.sender, msg.value,0,0,token_amount); + } + + /** + * @dev Sells tokens for ETH. + * internal function + */ + function sell(uint256 sell_amount) internal { + + require(tradingEnable, "Trading not enable"); + + uint256 ethAmount = (sell_amount * address(this).balance) / (_balances[address(this)] + sell_amount); + + require(ethAmount > 0, "Sell amount too low"); + require(address(this).balance >= ethAmount, "Insufficient ETH in reserves"); + + _transfer(msg.sender, address(this), sell_amount); + payable(msg.sender).transfer(ethAmount); + + emit Swap(msg.sender, 0,sell_amount,ethAmount,0); + } + + /** + * @dev Fallback function to buy tokens with ETH. + */ + receive() external payable { + buy(); + } +} + + +contract Simplify_314 is ERC314 { + uint256 private _totalSupply = 1_000_000 * 10 ** 18; + + constructor() ERC314("Simplify 314", "SIMP", _totalSupply) { + } +} \ No newline at end of file diff --git a/hardhat.config.ts b/hardhat.config.ts index a107e2c..8cfde1e 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -34,7 +34,7 @@ const config: HardhatUserConfig = { settings: { optimizer: { enabled: true, - runs: 100, + runs: 200, }, metadata: { bytecodeHash: "none", @@ -98,6 +98,9 @@ const config: HardhatUserConfig = { process.env.TESTNET_PRIVATE_KEY !== undefined ? [process.env.TESTNET_PRIVATE_KEY] : [], + allowUnlimitedContractSize: true, + gas: 12000000, + blockGasLimit: 0x1fffffffffffff, }, localhost: { url: `http://localhost:8545`, diff --git a/package.json b/package.json index ec05d42..55edbcb 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "deploy-aime-op-sepolia": "npx hardhat run --network optimismSepolia ./scripts/aime/deploy_aime.ts", "verify-aime-op-sepolia": "npx hardhat verify --contract contracts/aime/AIMeFactory.sol:AIMeFactory --network optimismSepolia", "deploy-aime-arb-sepolia": "npx hardhat run --network arbitrumSepolia ./scripts/aime/deploy_aime.ts", - "verify-aime-arb-sepolia": "npx hardhat verify --contract contracts/aime/AIMeFactory.sol:AIMeFactory --network arbitrumSepolia", + "verify-aime-arb-sepolia": "npx hardhat verify --contract contracts/aime/AIMeFactoryV2.sol:AIMeFactoryV2 --network arbitrumSepolia", "deploy-nft": "npx hardhat run --network sepolia ./scripts/aime/deploy_test.ts", "verify-nft": "npx hardhat verify --contract contracts/aime/MockNFT.sol:MockNFT --network sepolia", "verify-sepolia": "npx hardhat verify --contract contracts/gptmining/GPTMinerV2.sol:GPTMinerV2 --network sepolia", diff --git a/scripts/aime/deploy_aime.ts b/scripts/aime/deploy_aime.ts index d2bb3f9..5ac2fe2 100644 --- a/scripts/aime/deploy_aime.ts +++ b/scripts/aime/deploy_aime.ts @@ -1,12 +1,12 @@ import { ethers } from "hardhat"; -import { AIMeFactory } from "../../typechain"; +import { AIMeFactoryV2 } from "../../typechain"; -async function deployAIMeForTest(): Promise { - const contractFactory = await ethers.getContractFactory("AIMeFactory"); +async function deployAIMeForTest(): Promise { + const contractFactory = await ethers.getContractFactory("AIMeFactoryV2"); const instance = await contractFactory.deploy(); await instance.deployed(); - console.log("AIMeFactory V0 contract deployed to", instance.address); + console.log("AIMeFactory V2 contract deployed to", instance.address); return instance; }