This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| solc --abi --include-path node_modules/ --base-path . contracts/LiquidityMiningCampaign.sol -o abis |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const numberToStringWithoutCommas = ( | |
| bigNumber: string | number = '0', | |
| minDecimals: number = 2, | |
| ): string => { | |
| const num = typeof bigNumber === 'number' ? bigNumber : parseFloat(bigNumber); | |
| if (num === 0) return '0.0'; | |
| if (Math.abs(num) < 0.01) return num.toFixed(4); | |
| if (Math.abs(num) < 0.1) return num.toFixed(3); | |
| if (Math.abs(num) < 10) return num === Math.floor(num) ? num.toString() : num.toFixed(2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const formatTokenInput = (value: number): string => { | |
| if (String(value).match(/^(0[1-9]+)/) || String(value).match(/^0{2,}[1-9]+/)) { | |
| // to remove any leading zero after a number | |
| return String(value).replace(/^[0.]+/, ''); | |
| } else if (String(value).match(/^0{2,}[\.,]/)) { | |
| // to remove leading zeroes when has decimal point | |
| return String(value).replace(/^0+/, '0'); | |
| } else if (String(value).match(/^0{2}/)) { | |
| // to remove zeroes in the beginning | |
| return String(value).replace(/^[0.]+/, '0'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| await contract.callStatic.transfer(to, amount); | |
| // to: being the address | |
| // amount: being the amount to transfer | |
| // return value: being the boolean that transfer returns |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function main() { | |
| let i, j, k; | |
| // this will guarantee that i < j < k | |
| for (i = 0; i <= 9; i++) { | |
| for (j = i + 1; j <= 9; j++) { | |
| for (k = j + 1; k <= 9; k++) { | |
| console.log("%d%d%d\n", i, j, k); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const signMessage = async (signer, provider) => { | |
| const message = ethers.utils.keccak256( | |
| ethers.utils.defaultAbiCoder.encode( | |
| ["uint256", "address"], | |
| [provider, signer.address] | |
| ) | |
| ); | |
| return await signer.signMessage(ethers.utils.arrayify(message)); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| π Morning 221 commits βββββββββββββββββββββ 20.9% | |
| π Daytime 475 commits βββββββββββββββββββββ 45.0% | |
| π Evening 322 commits βββββββββββββββββββββ 30.5% | |
| π Night 37 commits βββββββββββββββββββββ 3.5% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const receipt = await tx.wait(); // this is the receipt from the transaction that was mined, with the logs for the transactions. | |
| const sig = ethers.utils.keccak256( | |
| ethers.utils.toUtf8Bytes( | |
| 'LogLiquidityRemove(address,address,uint256,uint256)', | |
| ), | |
| ); | |
| const resultFilter = receipt.logs.filter((item) => | |
| item.topics.includes(sig), | |
| )[0]; | |
| const balancesFromRemove = ethers.utils.defaultAbiCoder.decode( |