I'm trying to create a smart asset that limits every amount of assets a portfolio can have, suppose I created Age Coin (fictitious and unofficial name) and want every portfolio to have only 100 assets. The goal is to disrupt large speculators who manipulate the market.
Asked
Active
Viewed 83 times
1
-
Welcome to SO. I recommend you to read https://stackoverflow.com/help/how-to-ask and rephrase your question here. – Bussller Apr 05 '19 at 03:50
1 Answers
1
You can easily check asset balance and deny transactions if current amount + incoming amount > 100
Full asset script can look like below:
{-# STDLIB_VERSION 2 #-}
{-# CONTENT_TYPE EXPRESSION #-}
{-# SCRIPT_TYPE ASSET #-}
match (tx) {
case t:TransferTransaction => {
let currentBalance = assetBalance(t.recipient, t.assetId)
currentBalance + t.amount <= 100
}
case _ => false
}

KardanovIR
- 482
- 1
- 4
- 17
-
Well, I think there's a problem with your script. It does not allow the distribution of tokens, since the creator ends up having more tokens than allowed. So, could this be done in a logic where the one who has more tokens than allowed can send but can not receive? – Yuri Gagarin Apr 06 '19 at 02:18