• Bundle id, app name can be changed easily by search and replace
  • The app icon had been checked for distribution to stores.
  • Application clean structure
  • I18n had been set up and sample
  • App env approach tested with CI
  • Compatible with appcenter.ms, bitrise.io (just use appcenter/bitrise for ci, it’ll recognize automatically)
  • Example of how to use rest API
  • Example of how to use provider
  • Example…


type(ITest).interfaceId
  • Return zero with empty interface
=> bytes4: 0x00000000// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface ITest {
}
contract Test is ITest {
bytes4 public constant IID_ITEST = type(ITest).interfaceId;
}
  • Return same id with difference return type
=> bytes4: 0x0ee2cb10// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface ITest {
function getCreator() external;
}
contract Test is ITest {
bytes4 public constant IID_ITEST = type(ITest).interfaceId;

function getCreator() external override { }
}
===========
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0…

  • Clean: No unused code, nonsense comment,
  • Well document: Comment to all functions
  • Formatted: Reformat, reformat, reformat
  • Unit test all functions
  • Migration for testnet and mainnet
  • Avoid duplication code, avoid using too many unnecessary modifiers to reduce contract size
  • Upgradable

About some checklist in contract function

  • Consider using nonReentrant modifier in paying function to avoid duplicate calls
  • Use safe math to check about substract and div operators. Get revert if you div zero, or assign a negative number to uint.
  • About…

What is “Dividend Token”?

You should search for more detail. =]] But you can go with some token like BabyCake, SafeMoon, ThunderCake, … cake family. :3

  • 1. Reflection reward on other coins to all holders
  • 2. Buyback to increase token buy volume
  • 3. Burn as disinflation policy
  • 4. Add LP to make the token is more stable

Reflection reward

  • If you think you…

Preparing source

  • Clone pancake-swap-core
git clone git@github.com:pancakeswap/pancake-swap-core.git
cd pancake-swap-core
git checkout -b factory 3b214306770e86bc3a64e67c2b5bdb566b4e94a7
yarn install
yarn compile
  • Clone pancake-swap-periphery
git clone git@github.com:pancakeswap/pancake-swap-periphery.git
cd pancake-swap-periphery
git checkout -b router d769a6d136b74fde82502ec2f9334acc1afc0732
yarn install
yarn add @uniswap/v2-core@"file:../pancake-swap-core"
yarn compile
  • Clone pancake-swap-interface-v1
git clone git@github.com:pancakeswap/pancake-swap-interface-v1.git
cd pancake-swap-interface-v1
git checkout -b v1 0257017f2daaae2f67c24ded70b5829f74a01b3c
yarn install

Setup

Install contract merger: https://www.npmjs.com/package/sol-merger

npm install sol-merger -g

Prepare PancakeFactory and PancakeRouter

sol-merger pancake-swap-core/contracts/PancakeFactory.sol ./build
sol-merger pancake-swap-core/contracts/PancakePair.sol ./build
sol-merger pancake-swap-periphery/contracts/PancakeRouter01.sol ./build
sol-merger pancake-swap-periphery/contracts/PancakeRouter.sol ./build


Config Server

nano /etc/zabbix/zabbix_server.conf===>Update DB information
  • Config frontend web
nano /etc/zabbix/web/zabbix.conf.php
===>
# Update DB information, must be matched with server config above
....
# Integrate with server
ZBX_SERVER = '**your zabbix ip address or name**';
ZBX_SERVER_PORT = '10051';
ZBX_SERVER_NAME = '**your zabbix hostname**';
Example
$ZBX_SERVER = 'localhost';
$ZBX_SERVER_PORT = '10051';
$ZBX_SERVER_NAME = 'zabbix.nhancv.com';
  • Restart server
sudo systemctl restart zabbix-server
sudo systemctl status zabbix-server
ps -ef | grep zabbix

Setup Agent

  • Access to vps agent -> Install zabbix-agent
wget https://repo.zabbix.com/zabbix/5.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.4-1+ubuntu20.04_all.deb
dpkg -i zabbix-release_5.4-1+ubuntu20.04_all.deb
apt update
apt install zabbix-agent
# If you enable firewall -> open ufw port…

  • A contract has an infinite internal storage
  • There are 2 limits to practicality: gas costs and the block gas limit.

Example

Create 5k5 players, read one time

  • [WRITE] Can add 500 player in 1 tx
  • [READ] Can not get all 5600 players (1600 is ok)
call to TestPlayerRead.getPlayers
call to TestPlayerRead.getPlayers errored: Error: Internal JSON-RPC error. { "code": -32000, "message": "out of gas" }
  • [READ] To read all data, should use paging approach

Setup MongoDB


* Check linux version: lsb_release -a
sudo apt install wget
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -

* https://docs.mongodb.com/manual/tutorial/install-mongodb-on-debian/
* Debian 10 "Buster"
echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.4 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list

* https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
* Ubuntu 20.04 (Focal)
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list

sudo apt update
sudo apt install -y build-essential
sudo apt install -y mongodb-org
sudo systemctl enable mongod
sudo service mongod start
  • Controls
- Start: sudo service mongod start
- Verify status: sudo cat /var/log/mongodb/mongod.log …

Make sure your application is stateless: share database/cache, cronjob
// https://pm2.keymetrics.io/docs/usage/application-declaration/
// # Start all applications
// pm2 start ecosystem.config.js
//
// # Stop all
// pm2 stop ecosystem.config.js
//
// # Restart all
// pm2 restart ecosystem.config.js
//
// # Reload all
// pm2 reload ecosystem.config.js
//
// # Delete all
// pm2 delete ecosystem.config.js
module.exports = {
apps: [{
name: "nestjs-prod",
script: "./dist/main.js",

sudo nano /etc/nginx/sites-available/api.nhancv.com

# start of file
# http {
upstream ncluster {
server 127.0.0.1:3000 weight=3;
server 127.0.0.1:3001;
}

server {
listen…

Nhan Cao

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store