3

Fixed-Point ABDK Math 64.64 binary scalar with 2^64 precision one of the more popular fixed-point libraries, it's been praised as being super efficient Exponential decimal scalar with 18 decimals developed by Compound.Finance Fixidity decimal scalar with arbitrary number of decimals slower than 64.64, but with a somewhat more palatable API DecimalMath ...


2

Found nice trick to avoid "Stack too deep" issue: function swapWithReferral( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 minReturn, uint256[] calldata distribution, uint256 flags, address referral, uint256 feePercent ) external makeGasDiscount(flags) returns(uint256 returnAmount) { ... fromToken....


1

I'm trying to test my contract functions in Truffle v5+ but getting TypeError: myContract.methods.register is not a function. Truffle's logical contract object, which can be generated by either one of the following: artifacts.require("...").new(<construction arguments>) artifacts.require("...").at(<deployment address>) artifacts.require("...")....


1

Yes that's actually the only safe and reasonable way to get the index of the last element. doing this: Array.length-1;


1

I wouldn't critique style and formatting too much as this is your first effort. It looks like it should work but you have to send from the owner account, but you don't set the owner, so it is still 0x0. Do address public owner; So you can inspect it, to confirm. The usual way to set the owner is the constructor. constructor() public { owner = msg....


1

You cannot use floating point numbers to interact with cryptocurrency, or any monetary units. You need to use a special helper class called BigNumber.js to do the math. Then you convert those numbers to strings before passing them to functions that go to JSON-RPC interface.


Only top voted, non community-wiki answers of a minimum length are eligible