Create resource with script

But I wish it were impossible to exchange below this price.
Then there is always:

To edit the script.

Yes, this line

case _ => true

allows you to edit the script later, because it would allow SetAssetScriptTransactions, among others.

Minimum exchange price is checked here:

e.price >= startPrice * (1 + years)

so it’d be impossible to exchange below this price.

I just did it in testnet.
Yesterday everything works.
I will investigate to see if the problem is due to me

I created new token in testnet with the same script.
It just doesn’t seem to work anymore.

This script only respects a minimum of 10 token units.
If you respect this quota the script allows you to buy sell at any price.
I am confused.

Sorry, I exchanged mainnet height for testnet.

In your script you have to assign the current blockchain height to startHeight:

let startHeight = 562376

The current testnet height can be found at

Because startHeight was too large, years = (height - startHeight) / interval was negative, and startPrice * (1 + years) was always less than any price

1 Like

State check failed. Reason: Fee for TransferTransaction (100000 in WAVES) does not exceed minimal value of 500000 WAVES

I receive this message when I try the transfer (testnet)
The code is:


let startHeight = 584032
let startPrice = 12000000
let interval = 8766 * 60
let exp = 41760 * 60 * 1000

match tx {
case e:ExchangeTransaction =>
let years = (height - startHeight) / interval

      e.price >= startPrice * (1 + years)
      && !isDefined(e.sellOrder.assetPair.priceAsset)
      && e.amount >= 1000000000
case _ => true



Up your TX fee from 100000 to 500000 and that error should go away.

I understand that it should go away.
But how to send that error away?

You need to set fee = 0.005 WAVES in your TransferTransaction

I ran a test.
In testnet it doesn’t work.
On mainnet it is working.

Can I create scripts for my wallet?
I would like to do:
Only maximum 100 wallets send transfers to my wallet.
A wallet that has reached 100 transfers to my wallet will remain locked for 24 hours.
Can anything be done?
Can anyone help me with the code?

Unfortunately, this cannot be done. Scripts validate only outgoing transactions.

1 Like