Standby Letter

Contract purpose

This contract is used as a Standby Letter in which someone requests a service and has another entity to guarantee that the product will be paid for.

Contract parameters

deadline: the time set by the customer for the supplier to deliver the product

contractValue: the amount of money that the supplier has to receive at the end

creditor: address of the entity which guarantees the supplier gets paid

supplier: address of the entity which provides the goods/services for the customer

Exposed methods and variables

customer: address of the creator of the letter

start: set after the creditor had ensured the balance of the contract

supplierPaidByCustomer: set true if the customer paid the supplier

supplierPaidByCreditor: set true if the creditor paid the supplier

start: set after the creditor had ensured the balance of the contract

creditorSendsMoney payable function that has to be called by the creditor with the amount set by the customer immediately after the contract creation for the other functions to work. Only after this function is called the start variable is set and the supplier can start working.

isDeadlineOverdue can be called by anyone to check if the set deadline is still valid or not

jobDone can be called only by the supplier when his job/service is finished

jobVerified the customer has to verify the delivered product before paying the supplier

customerPaysSupplier after the product was verified, the customer has to pay the supplier calling this payable function with the value set at the beginning and the creditor also receives his money back

creditorPaysSupplier if the product was delivered in due time and the customer failed to verify it or pay for it, it is the creditor responsibility to send the money to the supplier

getBalance: returns the contract balance

Reviewed by Modex
Buy Contract Test Contract

Create an account or login to purchase this smart contract