Comment by superzamp

Comment by superzamp 10 months ago

2 replies

Well that's definitely a good puzzle. I've tried to model it for a bit, but it indeed looks like we'd need to add something to the language to make it possible at all! Thanks for bringing this up.

fallat 10 months ago

Same thing with income tax brackets. You need conditional logic.

  • superzamp 10 months ago

    For this particular case, I would say that tax-brackets sort of logic can be expressed in the destination block with ordered destinations.

    For example, you could have something like this:

        send [USD/2 *] (
          source = @users:1234
          destination = {
            // first $1000 are taxed at 10%
            max [USD/2 100000] to {
              10% to @taxes
              remaining kept
            }
            // Anything above that is, taxed at 20%
            remaining to {
              20% to @taxes
              remaining kept
            }
          }
        )
    
    (You can test it on the playground, you'll just want to feed the "users:1234" account with an initial balance in the input section)