caivega / ipfslib

Other
2 stars 1 forks source link

S2 - 发行代币,decimals没有起作用 #153

Closed foreso-GitHub closed 3 years ago

foreso-GitHub commented 3 years ago

发行代币时,decimals没有起作用。比如我现在发行一个代币,总量100,decimals为4,应该有100*104个最小单位,在balance和tx的amount应该是1000000。但实际发行后,amount只有100。 发送代币时,decimal是起作用的。

请求:

{
    "jsonrpc": "2.0",
    "method": "jt_sendTransaction",
    "params": [
        {
            "from": "jHb9CJAWyB4jr91VRWn96DkukG4bwdtyTh",
            "secret": "snoPBjXtMeMyMHUVTgbuqAfg1SUTb",
            "fee": "10",
            "type": "IssueCoin",
            "name": "TestCoin_SWT_213",
            "symbol": "TSC_SWT_214",
            "decimals": "4",
            "total_supply": "100",
            "local": true,
            "flags": 0
        }
    ],
    "id": 1
}

结果:

{
    "id": 1,
    "jsonrpc": "2.0",
    "result": {
        "TransactionType": "IssueCoin",
        "Flags": 2147483648,
        "Account": "jHb9CJAWyB4jr91VRWn96DkukG4bwdtyTh",
        "Sequence": 682,
        "Fee": "10",
        "SigningPubKey": "0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020",
        "TxnSignature": "3044022004BA5318EC41FDAE9D229AEC6B7DA79367F6B936B6C831F7812FCA7408CC5682022006688D858C60D1F3EE5DC2A4C2AD6473E31B4B6EE87B1E2C87A537181A00CCD6",
        "hash": "1BEE4A67251CDC02FD4168FBAE77677AEE19FCC5C74AA5391B051A554659143F",
        "Name": "TestCoin_SWT_213",
        "Decimals": 4,
        "TotalSupply": {
            "value": "100",
            "currency": "TSC_SWT_214",
            "issuer": "jHb9CJAWyB4jr91VRWn96DkukG4bwdtyTh"
        },
        "Owner": "jHb9CJAWyB4jr91VRWn96DkukG4bwdtyTh",
        "date": 662026060,
        "inLedger": 34848,
        "ledger_index": 34848
    }
}

TestCase:

foreso-GitHub commented 3 years ago

同时参见#147

foreso-GitHub commented 3 years ago

By design,如果发行代币时需要decimal起作用,需要加上symbol,比如:

{
    "jsonrpc": "2.0",
    "method": "jt_sendTransaction",
    "params": [
        {
            "from": "jHb9CJAWyB4jr91VRWn96DkukG4bwdtyTh",
            "secret": "snoPBjXtMeMyMHUVTgbuqAfg1SUTb",
            "fee": "10",
            "type": "IssueCoin",
            "name": "TestCoin_SWT_213",
            "symbol": "TSC_SWT_216",
            "decimals": "4",
            "total_supply": "100.02/TSC_SWT_216",
            "local": true,
            "flags": 0
        }
    ],
    "id": 1
}