Magickbase / shaping

MIT License
2 stars 2 forks source link

Quantitative accuracy of tokens #17

Closed Keith-CY closed 2 years ago

Keith-CY commented 2 years ago
Keith-CY commented 2 years ago

current supply algorithm

Bridged tokens

current supply = token_in - token_out

Native token

current supply = totalSupply of ERC20 contract

Keith-CY commented 2 years ago

Distribution

Bridged Token

rpc gw_get_balance

Native token

IERC20.balanceOf

Keith-CY commented 2 years ago

Timing

Bridged

There're no events emitted when a bridged token is minted or burned, jjy is trying to find out useful block logs about deposit and withdrawal. But deserializing transactions is still recommended.

Ref: https://github.com/nervosnetwork/godwoken-polyjuice/blob/main/solidity/erc20/SudtERC20Proxy_UserDefinedDecimals.sol

Considering adding deposit and withdrawal events on block generation, an issue has been committed

For now, we are going to use the current strategy to update bridged token distribution.

Native token

listen to {transfer} event from the contract Get logs from transactions

Keith-CY commented 2 years ago

Now tokens are updated by logs