Skip to content

Commit

Permalink
Merge pull request #222 from bnb-chain/develop
Browse files Browse the repository at this point in the history
release: prepare for v0.0.4
  • Loading branch information
unclezoro authored Oct 13, 2022
2 parents d2f5cc5 + d23d52d commit 45dd937
Show file tree
Hide file tree
Showing 130 changed files with 1,389 additions and 6,310 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,6 @@ vendor
deployment/dependency
deployment/configs
deployment/.zkbnb
run_*.sh
run_*.sh

own*
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ tools:
build: api-server build-only

lint:
go install github.com/golangci/golangci-lint/cmd/[email protected]
golangci-lint run ./...

build-only:
Expand Down
15 changes: 1 addition & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ ZkBNB achieves the following goals:
cryptographic. Users do not have to trust any third parties or keep monitoring the Rollup blocks in order to
prevent fraud.
- **L1<>L2 Communication**. BNB, and BEP20/BEP721/BEP1155 created on BSC or ZkBNB can flow freely between BSC and ZkBNB.
- **Built-in instant AMM swap**. It allows digital assets to be traded without permission and automatically by using
liquidity pools.
- **Built-in NFT marketplace**. Developer can build marketplace for crypto collectibles and non-fungible tokens (NFTs)
out of box on ZkBNB.
- **Fast transaction speed and faster finality**.
Expand All @@ -35,7 +33,6 @@ ZkBNB starts its development based on [Zecrey](https://github.com/bnb-chain/zecr
- [Key Features](#Key-Features)
+ [Digital Asset Management](#Digital-Asset-Management)
+ [NFT Management and Marketplace](#NFT-Management-and-Marketplace)
+ [AMM Exchange](#AMM-Exchange)
+ [Native Name Service](#Native-Name-Service)
+ [Seamless L1 Wallet Management](#Seamless-L1-Wallet-Management)

Expand All @@ -59,7 +56,7 @@ ZkBNB starts its development based on [Zecrey](https://github.com/bnb-chain/zecr
- **prover**. Prover generates cryptographic proof based on the witness materials.
- **sender**. The sender rollups the compressed l2 blocks to L1, and submit proof to verify it.
- **api server**. The api server is the access endpoints for most users, it provides rich data, including
digital assets, blocks, transactions, swap info, gas fees.
digital assets, blocks, transactions, gas fees.
- **recovery**. A tool to recover the sparse merkle tree in kv-rocks based on the state world in postgresql.


Expand Down Expand Up @@ -105,16 +102,6 @@ being sent to the ZkBNB. Once the offer is matched, an **AtomicMatch** transacti
will be sent to ZkBNB to make the trade happen. Users can also cancel an offer manually by sending a cancel offer
transaction to disable the backend cached offer.

### AMM Exchange

Automated market makers (AMM) are decentralized exchanges that pool liquidity from users and price the assets within
the pool using algorithms.

ZkBNB follows the similar mechanic as [UniSwap V2](https://docs.uniswap.org/protocol/V2/concepts/protocol-overview/how-uniswap-works).
Anyone can become a liquidity provider (LP) for a pool by depositing an equivalent value of each underlying token in
return for pool tokens. The different from UniSwap is that the LP token on ZkBNB can not transfer or trade. Users can
simply list a swap pair by calling the rollup contract on BSC.

### Native Name Service
No more copying and pasting long addresses on ZkBNB. Every account on ZkBNB gets its short name, user can use that to
store funds and receive any cryptocurrency, token, or NFT.
Expand Down
23 changes: 0 additions & 23 deletions common/chain/balance_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,36 +36,13 @@ func ComputeNewBalance(assetType int64, balance string, balanceDelta string) (ne
return "", err
}
assetInfo.Balance = ffmath.Add(assetInfo.Balance, assetDelta.Balance)
assetInfo.LpAmount = ffmath.Add(assetInfo.LpAmount, assetDelta.LpAmount)
if assetDelta.OfferCanceledOrFinalized == nil {
assetDelta.OfferCanceledOrFinalized = types.ZeroBigInt
}
if assetDelta.OfferCanceledOrFinalized.Cmp(types.EmptyOfferCanceledOrFinalized) != 0 {
assetInfo.OfferCanceledOrFinalized = assetDelta.OfferCanceledOrFinalized
}
newBalance = assetInfo.String()
case types.LiquidityAssetType:
// balance: LiquidityInfo
liquidityInfo, err := types.ParseLiquidityInfo(balance)
if err != nil {
return "", err
}
deltaLiquidity, err := types.ParseLiquidityInfo(balanceDelta)
if err != nil {
return "", err
}
liquidityInfo.AssetAId = deltaLiquidity.AssetAId
liquidityInfo.AssetBId = deltaLiquidity.AssetBId
liquidityInfo.AssetA = ffmath.Add(liquidityInfo.AssetA, deltaLiquidity.AssetA)
liquidityInfo.AssetB = ffmath.Add(liquidityInfo.AssetB, deltaLiquidity.AssetB)
liquidityInfo.LpAmount = ffmath.Add(liquidityInfo.LpAmount, deltaLiquidity.LpAmount)
if deltaLiquidity.KLast.Cmp(types.ZeroBigInt) != 0 {
liquidityInfo.KLast = deltaLiquidity.KLast
}
liquidityInfo.FeeRate = deltaLiquidity.FeeRate
liquidityInfo.TreasuryAccountIndex = deltaLiquidity.TreasuryAccountIndex
liquidityInfo.TreasuryRate = deltaLiquidity.TreasuryRate
newBalance = liquidityInfo.String()
case types.NftAssetType:
// just set the old one as the new one
newBalance = balanceDelta
Expand Down
152 changes: 0 additions & 152 deletions common/chain/liquidity_helper.go

This file was deleted.

83 changes: 0 additions & 83 deletions common/chain/liquidity_helper_test.go

This file was deleted.

Loading

0 comments on commit 45dd937

Please sign in to comment.