The error I am getting when I compile is: (ParserError: Expected primary expression.price = _price; * (1 ether);)
I would like to add a timestamp of 7 days for the promoter to add all funds to escrow in full not half to meet my conditions to book us. Is this even possible as a condition for us on our in? Do I need a multisig added to my smart contract to make it secure on both sides or is this code ok? Can anyone assist me in solving this problem?
//SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
contract Escrow {
//VARIBALES
enum State { NOT_INITIATED, AWAITING_PAYMENT, AWAITING_DELIVERY, COMPLETE }
State public currState;
bool public isBuyerIn;
bool public isSellerIn;
uint public price;
address public buyer;
address payable public seller;
//MODIFIERS
modifier onlyBuyer() {
require(msg.sender == buyer, "Only buyer can call this function"); _;
}
modifier escrowNotStarted() {
require(currState == State.NOT_INITIATED);
_;
}
//FUCTIONS
constructor(address _buyer, address payable _seller, uint _price){
buyer =_buyer;
seller = _seller;
price = _price; * (1 ether);
}
function initContract() escrowNotStarted public{
if(msg.sender == buyer) {
isBuyerIn = true;
}
if (msg.sender == seller) {
isSellerIn = true;
}
if (isBuyerIn && isSellerIn) {
currState = State.AWAITING_PAYMENT;
}
}
function deposit() onlyBuyer public payable {
require(currState == State.AWAITING_PAYMENT, "Already paiid");
require(msg.value == price, "Wrong deposit amount");
currState = State.AWAITING_DELIVERY;
}
function confimDelivery() onlyBuyer payable public {
require(currState == State.AWAITING_DELIVERY, "Cannot confirm delivery");
seller.transfer(price);
currState = State.COMPLETE;
}
function withdraw() onlyBuyer payable public {
require(currState == State.AWAITING_DELIVERY, "Cannot withdraw at this stage");
payable(msg.sender).transfer(price);
currState = State.COMPLETE;
}
}
You have an extra semicolon on the
price
assigning line in theconstructor
.Replace
with