mirror of
https://github.com/0xShay/ticketchain.git
synced 2026-01-11 13:13:25 +00:00
Merged main into contracts-merge
This commit is contained in:
@@ -1,66 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
|
||||
pragma solidity >=0.8.2 <0.9.0;
|
||||
|
||||
|
||||
contract Escrow {
|
||||
|
||||
struct EscrowContract {
|
||||
address buyer;
|
||||
address seller;
|
||||
uint256 amount;
|
||||
bool buyerApproved;
|
||||
bool sellerApproved;
|
||||
bool isComplete;
|
||||
}
|
||||
|
||||
mapping(uint256 => EscrowContract) public escrows;
|
||||
uint256 public escrowCounter;
|
||||
|
||||
function createEscrow(address _seller) public payable {
|
||||
escrows[escrowCounter] = EscrowContract(msg.sender, _seller, msg.value, false, false, false);
|
||||
escrowCounter++;
|
||||
}
|
||||
|
||||
function approveEscrow(uint256 escrowId) public {
|
||||
require(escrowId < escrowCounter, "Invalid escrow ID");
|
||||
require(msg.sender == escrows[escrowId].buyer || msg.sender == escrows[escrowId].seller, "Unauthorized");
|
||||
|
||||
if (msg.sender == escrows[escrowId].buyer) {
|
||||
escrows[escrowId].buyerApproved = true;
|
||||
} else {
|
||||
escrows[escrowId].sellerApproved = true;
|
||||
}
|
||||
|
||||
if (escrows[escrowId].buyerApproved && escrows[escrowId].sellerApproved) {
|
||||
escrows[escrowId].isComplete = true;
|
||||
(bool sent, ) = escrows[escrowId].seller.call{value: escrows[escrowId].amount}("");
|
||||
require(sent, "Failed to send FLR to seller");
|
||||
}
|
||||
}
|
||||
|
||||
function getEscrowAmount(uint256 escrowId) public view returns (uint256) {
|
||||
return escrows[escrowId].amount;
|
||||
}
|
||||
|
||||
function getEscrowBuyer(uint256 escrowId) public view returns (address) {
|
||||
return escrows[escrowId].buyer;
|
||||
}
|
||||
|
||||
function getEscrowSeller(uint256 escrowId) public view returns (address) {
|
||||
return escrows[escrowId].seller;
|
||||
}
|
||||
|
||||
function getEscrowBuyerApproved(uint256 escrowId) public view returns (bool) {
|
||||
return escrows[escrowId].buyerApproved;
|
||||
}
|
||||
|
||||
function getEscrowSellerApproved(uint256 escrowId) public view returns (bool) {
|
||||
return escrows[escrowId].sellerApproved;
|
||||
}
|
||||
|
||||
function getEscrowIsComplete(uint256 escrowId) public view returns (bool) {
|
||||
return escrows[escrowId].isComplete;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity >=0.8.0 <0.9.0;
|
||||
|
||||
import {ContractRegistry} from "@flarenetwork/flare-periphery-contracts/coston2/ContractRegistry.sol";
|
||||
/* THIS IS A TEST IMPORT, in production use: import {FtsoV2Interface} from "@flarenetwork/flare-periphery-contracts/coston2/FtsoV2Interface.sol"; */
|
||||
import {TestFtsoV2Interface} from "@flarenetwork/flare-periphery-contracts/coston2/TestFtsoV2Interface.sol";
|
||||
|
||||
/**
|
||||
* THIS IS AN EXAMPLE CONTRACT.
|
||||
* DO NOT USE THIS CODE IN PRODUCTION.
|
||||
*/
|
||||
contract FtsoV2FeedConsumer {
|
||||
TestFtsoV2Interface internal ftsoV2;
|
||||
// Feed IDs, see https://dev.flare.network/ftso/feeds for full list
|
||||
bytes21[] public feedIds = [
|
||||
bytes21(0x01464c522f55534400000000000000000000000000) // FLR/USD
|
||||
// bytes21(0x014254432f55534400000000000000000000000000), // BTC/USD
|
||||
// bytes21(0x014554482f55534400000000000000000000000000) // ETH/USD
|
||||
];
|
||||
|
||||
/**
|
||||
* Constructor initializes the FTSOv2 contract.
|
||||
* The contract registry is used to fetch the FtsoV2 contract address.
|
||||
*/
|
||||
constructor() {
|
||||
/* THIS IS A TEST METHOD, in production use: ftsoV2 = ContractRegistry.getFtsoV2(); */
|
||||
ftsoV2 = ContractRegistry.getTestFtsoV2();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current value of the feeds.
|
||||
*/
|
||||
function getFtsoV2CurrentFeedValues()
|
||||
external
|
||||
view
|
||||
returns (
|
||||
uint256[] memory _feedValues,
|
||||
int8[] memory _decimals,
|
||||
uint64 _timestamp
|
||||
)
|
||||
{
|
||||
return ftsoV2.getFeedsById(feedIds);
|
||||
}
|
||||
}
|
||||
8697
package-lock.json
generated
8697
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
13
package.json
13
package.json
@@ -11,18 +11,27 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@flarenetwork/flare-periphery-contracts": "^0.1.16",
|
||||
"@metamask/sdk-react": "^0.30.0",
|
||||
"@radix-ui/react-icons": "^1.3.0",
|
||||
"@radix-ui/react-label": "^2.1.0",
|
||||
"@radix-ui/react-popover": "^1.1.2",
|
||||
"@radix-ui/react-select": "^2.1.2",
|
||||
"@radix-ui/react-separator": "^1.1.0",
|
||||
"@radix-ui/react-slot": "^1.1.0",
|
||||
"class-variance-authority": "^0.7.0",
|
||||
"clsx": "^2.1.1",
|
||||
"embla-carousel-react": "^8.3.0",
|
||||
"ethers": "^5.7.2",
|
||||
"framer-motion": "^11.11.10",
|
||||
"lucide-react": "^0.446.0",
|
||||
"next": "14.2.13",
|
||||
"react": "^18",
|
||||
"react-dom": "^18",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
"tailwind-merge": "^2.5.2",
|
||||
"tailwindcss-animate": "^1.0.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/ethereum-protocol": "^1.0.5",
|
||||
"@types/node": "^20",
|
||||
"@types/react": "^18",
|
||||
"@types/react-dom": "^18",
|
||||
|
||||
Reference in New Issue
Block a user