BoostryJP / ibet-SmartContract

Tokens and DEX contracts available in the ibet DeFi network 🔗
https://ibet.jp/ibet-for-fin
Apache License 2.0
18 stars 3 forks source link

[BUG] IssueFrom/RedeemFrom with a locked address does not work correctly #323

Closed YoshihitoAso closed 3 years ago

YoshihitoAso commented 3 years ago

Describe the bug

The following is the current code.

function issueFrom(address _target_address, address _locked_address, uint256 _amount)
        public
        onlyOwner()
    {
        // locked_addressを指定した場合:ロック資産に対して追加発行を行う
        // locked_addressを指定しない場合:アカウントアドレスの残高に対して追加発行を行う
        if (_locked_address != address(0)) {
            // ロック資産の更新
            locked[_target_address][_locked_address] = lockedOf(_target_address, _locked_address).add(_amount);
            // 総発行数量の更新
            totalSupply = totalSupply.add(_amount);
        } else {
            // アカウント残高の更新
            balances[_target_address] = balanceOf(_target_address).add(_amount);
            // 総発行数量の更新
            totalSupply = totalSupply.add(_amount);
        }
        emit Issue(msg.sender, _target_address, _locked_address, _amount);
    }
locked[_target_address][_locked_address] = lockedOf(_target_address, _locked_address).add(_amount);

There is an error in the logic in this section.

The correct code is as follows.

locked[_locked_address][_target_address] = lockedOf(_locked_address, _target_address).add(_amount);