0

I would like to build a smart token that can readily be used with existing wallets. The objective is a seamless UX for buyers and sellers without complex data input requirements. Transactions by those who use the token are automatically guaranteed.

My token would hold the funds transferred by the buyer and the same amount from the seller in escrow until either released by the buyer (full satisfaction with product/service) or after one month (default). The seller may release all funds without transfer (if the merchandise is defective, &c). The buyer may submit a second payment that s/he feels is more appropriate (similarly held), which if accepted by the seller, would release the original escrow. If escrow release is halted by the buyer before the specified time period, a third party, selected by both parties (via a linked arbitration contract) would be authorized to release funds or complete the payment transfer.

How much of this functionality is possible in a coin (without a custom wallet)?

  • By "custom wallet" do you mean a smart contract? Or a wallet capable of calling contract functions? The question is currently a yes/no question, which is maybe too short an answer to be interesting. The how & why is probably too broad for one question. It needs some decomposition into parts. – carver Sep 15 '17 at 15:13
  • I'm referring to a wallet that calls contract functions - which would be plan B if the coin itself cannot be automated. – John Kosanke Sep 20 '17 at 13:28
1

Wallet software generally supports the ERC 20 standard. ERC 20 specifies an API for sending, querying balances etc. It doesn't specify an API for some of your other features, like setting an escrow partner.

So to support your various features, you would need to either make dedicated software (eg a dapp using MetaMask) or make your users call non-standard functions manually. However, to the extent that normal token operations like transfer() made sense in this context, these could be performed with a normal wallet.

1

Yes, You can implement escrow functionality in the contract using the multi signature concept. The transaction will happen only if both parties agree to that. Below code will help you to understand the functionality.

/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSig(address[] _owners, uint _required)
    public
    validRequirement(_owners.length, _required)
{
    for (uint i=0; i<_owners.length; i++) {
        if (isOwner[_owners[i]] || _owners[i] == 0) throw;
        isOwner[_owners[i]] = true;
    }
    isMultiSigWallet = true;
    owners = _owners;
    required = _required;
}
// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
    public
    returns (uint transactionId)
{
    transactionId = addTransaction(destination, value, data);
    confirmTransaction(transactionId);
}

/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
    public
    ownerExists(msg.sender)
    transactionExists(transactionId)
    notConfirmed(transactionId, msg.sender)
{
    confirmations[transactionId][msg.sender] = true;
    Confirmation(msg.sender, transactionId);
    executeTransaction(transactionId);
}

/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
    public
    ownerExists(msg.sender)
    confirmed(transactionId, msg.sender)
    notExecuted(transactionId)
{
    confirmations[transactionId][msg.sender] = false;
    Revocation(msg.sender, transactionId);
}

/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
    public
    constant
    returns (bool)
{
    uint count = 0;
    for (uint i=0; i<owners.length; i++) {
        if (confirmations[transactionId][owners[i]])
            count += 1;
        if (count == required)
            transfer(_from,_to,_value);
    }
}
  • What is validRequirement modifier doing? it is not further specified in this code example – saitam Mar 12 '18 at 18:54
0

Sort of. You can put a check in; if time > startTime + 30 days, then allow withdrawal.

But the user still has to call the withdrawal function (which you can't without other software AFAIK). You could however do a withdrawal instead if the above condition is met and the user pays 0 ether.

If actual ether is deposited, then you could do a regular deposit.

But I think this would be a lot nicer with an app.

Someone correct me if I'm wrong.

  • So the coin can have a built-in time delay after it is sent but before it can be spent? – John Kosanke Sep 20 '17 at 13:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.