/* *********************************************************************
 * Author: Rui Deleterium
 * Project: https://github.com/deleterium/SmartC
 * License: BSD 3-Clause License
 * *********************************************************************
 
         SmartC NFT migration notice

Please note that items were migrated to version 2.
They can be traded here.


const description = "Be owner of SmartC keywords, support the project and also make an investment! The first multi function and multi items smart contract on Signum blockchain, created with SmartC."

const NFT_account = ''
const NFT_alias = 'SmartCNFT'

function get_current_owners () {

// Thanks to people currently supporting the project!

let owners_table = {

fetching data...

}

return owners_table

}

function get_items_status () {

let items_status = [
fetching data...

]

return items_status

}

function starting_guide () {

return "This is a smart contract that allows interaction between accounts to buy, sell, hold or auction items. Commands are sent as transactions with unencrypted text messages. The owners have control over their items. A minimum value of 2 signa is necessary for the contract to be activated, but for simple operations some unspent amount will be refunded. "

}

function how_to_buy () {

return "Send an amount greater or equal current item price (plus 2 signa for contract activation) with a unencrypted text message buy continue to S-2Z65-L478-VKD4-386YY to become its new owner. If the amount is greater than current price, the contract will refund the excess paid. If the amount is lower than price, contract will refund transaction and sale will not occur. After a sucessfull sale, contract will set item price 10% higher than last one and item will stay on sale."

}

function how_to_bid () {

return "Send an amount greater or equal item minimal bid (plus 2 signa for contract activation) with a unencrypted text message bid const to S-2Z65-L478-VKD4-386YY with to have your bid accepted. Any excess amount will be understood as a greater bid offer, so no refund will happen. If the amount is lower than minimum bid, transaction is refunded and bid will not be accepted. On sucessfull bid, the balance will be secured in contract account. On auction end the balance will be sent to previous item owner and the highest bid sender will be new owner. If a new higher bid is received, previous bid will be refund to previous bid sender."

}

function owner_commands () {

/* Send a transaction with at least 2 signa and add the command as unencrypted text message! */

/* Do not use `Messages` window in your wallet. Use `Send Signa` instead. */

let hold = 'Send 2 signa and the command hold asm to ' + NFT_account + ' and item will be safe. Ownership is protected until another command is sent.'

let sell = 'Send 2 signa and the command sell asm 500 to ' + NFT_account + ' and item asm will be on sale for 500 signa. Anyone who sends 502 signa (remember 2 signa for contract activation) will be the new owner. Previous onwer will receive the price minus a support fee of 3% for Sigcc project (in this case 485 signa).'

let auction = 'Send 2 signa and the command auction while 50 to ' + NFT_account + ' and item while will be on auction with starting bid of 50 signa. Once it receives the first BID, no further command will be possible by owner until auction ends.'

}

function general_commands () {

let status = "Send 2 signa and the command status do to S-2Z65-L478-VKD4-386YY and contract will send back a message to inform if item `do` is 1) locked; 2) on sale and its price; or 3) on auction with next bid amount and the numbers of blocks until auction's end. This feature makes the contract blockchain complete, it is not dependent of this webpage.

let buy = how_to_buy()

let bid = how_to_bid()

}

function auction_help () {

let first_stage = "Owner sends a message to start an auction. While there is no bids, owner can still change starting price, change to sale, or even lock again the item."

let second_stage = "After first bid is accepted, the auction is unstoppable by owner. When a new bid is accepted, a new minimal bid is set 10% higher than the current bid and a new end date is set after 1440 blocks (4 days). The highest bid amount will stay on contract balance and previous bid is refunded.

let third_stage = "It is auction end. From the highest bid amount is deducted an extra contract fee of 1 Signa (auction demands extra computations). Then it is deducted a support fee of 3% for Sigcc project. The previous owner receives the remaining signa and the new owner receives a message to inform ownership. Two hours before an auction end, if a message is received, the contract stays awake to avoid delays on payment. If there is no message within this time, then the auction will be ended on next transaction, before processing it. Auctioned item status will be changed to 'hold'.

}

function FAQ (question) {

let answer

switch (question) {


case 'Why my transaction was not processed?':

answer = 'Check if the transaction was sent with some signa. Transactions with amounts lower than 2 signa will not be processed by contract, so it will not respond. All messages sent by `Messages` window in the wallet are sent with zero signa and will not be processed.'

break


case 'Why contract responded `No message`?':

answer = 'This means the transaction had no command or the attached message was encrypted. Check message content and be sure it was not encrypted.'

break


case 'Why contract responded `Parser err`?':

answer = 'This means contract could not parse the command. Maybe the action was not understood, or keyword name is wrong, or it is missing a field. Check spelling for keywords and use only one space between words.'

break


case 'What is maximum price possible for one item?':

answer = 'Contract can undestand only the 8 last chars for each field. This means that the maximum price for an item is 99999999 signa. If user send a comand `sell asm 100000099` the contract will get only 99 as the price.'

break


case 'Why contract is getting my price wrong?':

answer = 'No decimals nor separators are allowed for price. A command `sell asm 1.234` will be undestood as 1 signa.'

break


default:

answer = 'Question not on database. Please add your question at: ' + links().project_webpage

}

return answer

}

function links () {

return {

project_webpage: 'https://deleterium.github.io/SmartC/',
NFT_source_code: 'https://github.com/deleterium/SmartC/blob/' +
'main/commemorative/v0.1_SmartC_NFT.md'
,
signum_network: 'https://signum.network/',
signum_on_discord: 'https://discord.gg/9rH2bbCNpe',
signum_on_telegram: 'https://t.me/signumnetwork',

}

}

/* Neat stats:
*/