MultiBaas provides users with the ability to, on a per-method per-input/output parameter basis, adjust how the value is interpreted on its way to the blockchain, or adjust the return value on its way back from the blockchain.
One example would be to dynamically insert a decimal point into a smart contract method that returns an amount of type uint256. As exact decimal numbers are not supported by Solidity, the standard way of handling this situation is to use an integer and shift it by a fixed number of decimal places.
In the popular ERC20 token standard, a decimals() method provides the number of decimals place to shift the uint256 (unsigned integer) values for other methods input/output parameters that relate to token balances. For example, if decimals() returns 3, then the return value of the totalSupply() method should be shifted by 3 decimal places to the left.
We start by querying the totalSupply() method for the “autotoken” instance (an alias for the address of a smart contract deployed on the Ethereum blockchain).
The total supply is therefore 123,000. If we query the contract’s decimals() method:
Therefore, the result of totalSupply(), along with all other balance/amount method input/output parameters should be shifted by 3 decimal places to the left.
We could instruct MultiBaas to automatically shift the result of the totalSupply() function by 3 places:
We can also instruct MultiBaas to use the output of another function to specify the number of decimals. In this way we can support a varying number of decimals across smart contract instances with a single configuration setup of MultiBaas.
This decimals function must satisfy the following requirements:
Making another request to MultiBaas to use the output of decimals() for the number of decimals of the totalSupply() method:
Again calling the totalSupply() method:
The total supply is therefore 123.000, with the decimal place shifted three places to the left.
Type conversions can be previewed by running their inputs or outputs through a temporary, non-persisted type conversion. This is done to generate a preview of what the converted type will look like for presentation in a UI.
The API request and response to preview a type conversion is as follows.
From the UI you can also update the type conversion settings.
MultiBaas currently supports Ethereum smart contracts written in the Solidity programming language, although support for additional ...
Due to the compilation process, it is currently required to combine your contracts into a single file before uploading.
MultiBaas compiles the smart contract server-side and provides feedback as to what sub-contracts are present in the source code.
After uploading a solidity file containing one or more smart contracts, you will be prompted to deploy or link the compiled contracts to a..
Besides deploying a smart contract to a new address, you can also link a smart contract to an existing instance.
Contracts, contract meta-data, deployed instances, and blockchain addresses have a number of user-defined attributes in order to help you...
Once you have uploaded and deployed or linked a smart contract you can then interact with it through either the UI or the API.
MultiBaas provides users with the ability to, on a per-method per-input/output parameter basis, adjust how the value is interpreted on its..
Multisignature (multisig) wallets are smart contracts that allow multiple signers to review and agree on an action on the blockchain ...