Helloo everyone
I have the following problem: I am deploying a contract in remix that has a function that cannot be called from the deployer address. I have a selling contract, the deployer address is the seller the purchase function cannot be called by him, because the seller cannot buy from himself. I deploy the contract in address X, than I switch to address Y and click the button purchase and the contract says "The seller cannot buy from himself!". In the Javascript VM everything works perfectly, problem is only injected web3 metamask. The same mistake bug comes in https in chrome and in http in firefox. Firefox only deploys this contract with one given address, with the other ones it does not deploy and displays in the terminal: "creation of purchase errored: Invalid parameters: must provide an Ethereum address."
I tried both rinkeby and kovan testnet.
Thank you very much in advance for any type of help!
this is the contract:
pragma solidity >=0.6;
contract purchase{
address payable public seller;
address payable public buyer;
address public shipper;
uint public bonifico_min;
uint private refund;
enum StatusType {Start,Paid,Accepted}
StatusType public status;
constructor(address s, uint min){
seller=payable(msg.sender);
status = StatusType.Start;
shipper = s;
bonifico_min=min;
}
function propose_and_pay() public payable{
require((status==StatusType.Start)&& (msg.value>=bonifico_min));
require(msg.sender!=seller, "The seller cannot buy from himself!");
buyer=payable(msg.sender);
status=StatusType.Paid;
}
function reject() public{
require(msg.sender==seller);
require(status==StatusType.Paid);
status = StatusType.Start;
}
function accept() public{
require(msg.sender==seller);
require(status==StatusType.Paid);
status = StatusType.Accepted;
}
function delivered() public{
require(status==StatusType.Accepted);
require(msg.sender==shipper);
status = StatusType.Start;
seller.transfer( (address(this)).balance );
}
function not_delivered() public{
require(status==StatusType.Accepted);
require(msg.sender==shipper);
status = StatusType.Start;
buyer.transfer( (address(this)).balance );
}
