Skip to content

Commit

Permalink
Merge pull request #360 from BoostryJP/feature/add_finish_transfer
Browse files Browse the repository at this point in the history
feat: add FinishTransfer event
  • Loading branch information
YoshihitoAso authored Dec 21, 2021
2 parents 10dde33 + 6595ab4 commit 2184d4d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
16 changes: 15 additions & 1 deletion contracts/exchange/IbetSecurityTokenEscrow.sol
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ contract IbetSecurityTokenEscrow is Ownable, IbetExchangeInterface {

/// Event: 移転承認
event ApproveTransfer(
uint256 indexed escrowId,
address indexed token,
string data
);

/// Event: 移転完了
event FinishTransfer(
uint256 indexed escrowId,
address indexed token,
address from,
Expand Down Expand Up @@ -472,6 +479,13 @@ contract IbetSecurityTokenEscrow is Ownable, IbetExchangeInterface {
true
);

// イベント登録
emit ApproveTransfer(
_escrowId,
application.token,
_transferApprovalData
);

return true;
}

Expand Down Expand Up @@ -533,7 +547,7 @@ contract IbetSecurityTokenEscrow is Ownable, IbetExchangeInterface {
);

// イベント登録
emit ApproveTransfer(
emit FinishTransfer(
_escrowId,
escrow.token,
escrow.sender,
Expand Down
16 changes: 10 additions & 6 deletions tests/exchange/test_IbetSecurityTokenEscrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1312,7 +1312,7 @@ def test_normal_1(self, users, st_escrow):

# approve transfer
latest_escrow_id = st_escrow.latestEscrowId()
st_escrow.approveTransfer(
tx = st_escrow.approveTransfer(
latest_escrow_id,
_transfer_approval_data,
{'from': _issuer}
Expand All @@ -1327,6 +1327,10 @@ def test_normal_1(self, users, st_escrow):
True
)

assert tx.events["ApproveTransfer"]["escrowId"] == latest_escrow_id
assert tx.events["ApproveTransfer"]["token"] == token.address
assert tx.events["ApproveTransfer"]["data"] == _transfer_approval_data

#######################################
# Error
#######################################
Expand Down Expand Up @@ -1620,11 +1624,11 @@ def test_normal_2(self, users, st_escrow):
True
)

assert tx.events["ApproveTransfer"]["escrowId"] == latest_escrow_id
assert tx.events["ApproveTransfer"]["token"] == token.address
assert tx.events["ApproveTransfer"]["from"] == _issuer
assert tx.events["ApproveTransfer"]["to"] == _recipient
assert tx.events["ApproveTransfer"]["data"] == _transfer_approval_data
assert tx.events["FinishTransfer"]["escrowId"] == latest_escrow_id
assert tx.events["FinishTransfer"]["token"] == token.address
assert tx.events["FinishTransfer"]["from"] == _issuer
assert tx.events["FinishTransfer"]["to"] == _recipient
assert tx.events["FinishTransfer"]["data"] == _transfer_approval_data

assert tx.events["EscrowFinished"]["escrowId"] == latest_escrow_id
assert tx.events["EscrowFinished"]["token"] == token.address
Expand Down

0 comments on commit 2184d4d

Please sign in to comment.