Shifts the decimal point of a numeric value. Us for turning prices into integers.
The Shift Decimal task is a purely functional task that takes two values - A and B - and outputs A * 10^B.
This task can be used to transform floating/fixed point values into integer values 2.54812 —> 254812. This task is commonly used to normalize price data into EVM-compatible formats. This task can also be used to convert a large EVM-normalized value (ex. 1500000000000000000 wei) into a human-readable format (1.5 Eth).
inputValue: string # Required
decimalPlaces: string # Required
outputName: string # Required
inputValue: Numeric. The value to be transformed.
decimalPlaces: Numeric. The number of decimal places to move the value. Positive values means the decimal is moved to the right.
round: Boolean. Whether or not to round the output down to the nearest integer value.
outputName: String. The name to be assigned to the resultant value. This is the name that will be extracted.
TimestampUnixtime of execution.
TaskDefinitionThe complete definition of this task at runtime.
TaskOutputDataThe complete set of returned values from this task.
This task returns one numeric value which is assigned the name given by
outputNamealong with any extracts.
Takes a value in Ether produced by a previous source/task. This scales the value up by 10^18 to produce a value in Wei which can be used back on-chain.
Takes the value and decimal count of an erc20 balance from a previous source/task. Scales the value down by the decimal count. Ex: 65 USDC is expressed as 65000000 USDC and USDC has a decimal count of 6. This normalizes the value to 65 for use in future tasks.
- Use a variable extracted from a previous task (ex. a value from a price API or an on-chain value) as an
- Only use a variable for
decimalPlacesif it is not possible to know the translation factor before runtime.
roundto true if you are returning a value back on-chain and to false if you are creating a human-readable value.
extractsunless there is a critical need for the timestamp.
- Typically you should ignore
excludeLogs. It is rare that your exponentiation needs to be concealed from logs.