diff --git a/web3/contracts/Lock.sol b/web3/contracts/Lock.sol deleted file mode 100644 index 4d1557d..0000000 --- a/web3/contracts/Lock.sol +++ /dev/null @@ -1,33 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.20; - -contract Lock { - - struct Event{ - string eventName; - string evntVenue; - uint256 Time; - uint256 Duration; - string createrName; - address creatorAddress; - } - - struct Person{ - string Name; - bytes1 Gender; - uint256 Age; - } - Event public myEvent; - function createEvent( - string calldata _eventName, - string calldata _evntVenue, - uint256 _Time, - uint256 _Duration, - address _creatorAddress - ) public - { - myEvent.eventName = _eventName; - myEvent.evntVenue = _evntVenue; - - } -} \ No newline at end of file diff --git a/web3/contracts/Nft.sol b/web3/contracts/Nft.sol new file mode 100644 index 0000000..4ec221b --- /dev/null +++ b/web3/contracts/Nft.sol @@ -0,0 +1,47 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; + +contract Nft { + + uint256 currentTime = block.timestamp; + struct Event{ + string eventName; + string evntVenue; + uint256 Time; + uint256 Duration; + string createrName; + address creatorAddress; + string imgUrl; + } + + struct Person{ + string Name; + bytes1 Gender; + uint256 Age; + } + + Event public myEvent; + function createEvent( + string calldata _eventName, + string calldata _evntVenue, + uint256 _Time, + uint256 _Duration, + address _creatorAddress, + string memory _imgUrl + ) + public returns (uint) + { + myEvent.eventName = _eventName; + myEvent.evntVenue = _evntVenue; + myEvent.Duration = _Duration; + myEvent.creatorAddress = _creatorAddress; + myEvent.imgUrl = _imgUrl; + + if (_Time < currentTime){ + return 0; + } + else { + myEvent.Time = _Time + currentTime; + } + } +} \ No newline at end of file diff --git a/web3/hardhat.config.ts b/web3/hardhat.config.ts index c4ef851..7861ef0 100644 --- a/web3/hardhat.config.ts +++ b/web3/hardhat.config.ts @@ -2,7 +2,7 @@ import { HardhatUserConfig } from "hardhat/config"; import "@nomicfoundation/hardhat-toolbox"; const config: HardhatUserConfig = { - solidity: "0.8.19", + solidity: "0.8.20", }; export default config;