I have run into issues with my current Escrow.sol smart contract. The Escrow.sol contract is intended to be the "Happy Median" in case two individuals within the exchange do not agree on the quality, accuracy, or description of the good or service. Here is the Escrow.sol contract code:
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
contract Escrow {
address payable public buyer;
address payable public merchant;
address public arbiter;
uint public itemId;
uint public amount;
mapping(address => bool) public releaseAmount;
mapping(address => bool) public refundAmount;
uint public releaseVote;
uint public refundVote;
bool public fundsSuccess;
address public holder;
constructor(uint _itemId, address payable _buyer, address payable _merchant, address _arbiter) payable {
buyer = _buyer;
merchant = _merchant;
arbiter = _arbiter;
fundsSuccess = false;
amount = msg.value;
holder = msg.sender;
itemId = _itemId;
}
function escrowDetails() view public returns(address, address, address, bool, uint, uint){
return (buyer, merchant, arbiter, fundsSuccess, releaseVote, refundVote);
}
function releaseAmountToMerchant(address perso) public{
require(fundsSuccess == false);
require(msg.sender == holder);
if ((perso == buyer || perso == merchant || perso == arbiter) && releaseAmount[perso] != true){
releaseAmount[perso] = true;
releaseVote +=1;
}
if(releaseVote == 2){
merchant.transfer(amount);
fundsSuccess = true;
}
}
function refundAmountToBuyer(address perso) public{
require(fundsSuccess == false);
require(msg.sender == holder);
if ((perso == buyer || perso == merchant || perso == arbiter) && refundAmount[perso] != true){
refundAmount[perso] = true;
refundVote +=1;
}
if(refundVote == 2){
buyer.transfer(amount);
fundsSuccess = true;
}
}
}
My idea was to add the Royalty functionality to the Escrow contract to disperse 5% of fees back to the address of choice with the code below. The royalty code below was used for an ERC1155 build, but I am trying to reuse it for the Escrow implementation.
/** @dev EIP2981 royalties implementation. */
// Maintain flexibility to modify royalties recipient (could also add basis points).
function _setRoyalties(address newRecipient) internal {
require(
newRecipient != address(0),
"Royalties: new recipient is the zero address"
);
_recipient = newRecipient;
}
function setRoyalties(address newRecipient) external onlyOwner {
_setRoyalties(newRecipient);
}
// EIP2981 standard royalties return.
function royaltyInfo(uint256 _tokenId, uint256 _salePrice)
external
view
override
returns (address receiver, uint256 royaltyAmount)
{
return (_recipient, (_salePrice * 1000) / 10000);
}
I receive this error from RemixeIDE Line 63 from solidity: ParserError: Expected '(' but got identifier
--> Escrow.sol:63:14: | 63 | function _setRoyaltiesaddress newRecipient) internal { | ^^^^^^^^^^^^^^^^^^^^
The original Escrow contract compiles a 100% fine. I am looking for ways to incorporate the royalties code correctly below into the escrow contract.
Any fixes, thoughts, or ideas are welcome. Thanks so much in advance for the time.