Skip to content

Commit

Permalink
Merge pull request #2806 from rsksmart/rskip427-integration
Browse files Browse the repository at this point in the history
Express the amount value in weis for peg-out related events
  • Loading branch information
josedahlquist authored Oct 24, 2024
2 parents a61e6fe + 8220d12 commit 31fdae2
Show file tree
Hide file tree
Showing 14 changed files with 1,298 additions and 939 deletions.
175 changes: 73 additions & 102 deletions rskj-core/src/main/java/co/rsk/peg/BridgeEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,110 +5,80 @@

public enum BridgeEvents {

LOCK_BTC("lock_btc",
new CallTransaction.Param[]{
new CallTransaction.Param(true, Fields.RECEIVER, SolidityType.getType(SolidityType.ADDRESS)),
new CallTransaction.Param(false, Fields.BTC_TX_HASH, SolidityType.getType(SolidityType.BYTES32)),
new CallTransaction.Param(false, "senderBtcAddress", SolidityType.getType(SolidityType.STRING)),
new CallTransaction.Param(false, Fields.AMOUNT, SolidityType.getType(SolidityType.INT256))
}
),
PEGIN_BTC("pegin_btc",
new CallTransaction.Param[]{
new CallTransaction.Param(true, Fields.RECEIVER, SolidityType.getType(SolidityType.ADDRESS)),
new CallTransaction.Param(true, Fields.BTC_TX_HASH, SolidityType.getType(SolidityType.BYTES32)),
new CallTransaction.Param(false, Fields.AMOUNT, SolidityType.getType(SolidityType.INT256)),
new CallTransaction.Param(false, "protocolVersion", SolidityType.getType(SolidityType.INT256))
}
),
REJECTED_PEGIN("rejected_pegin",
new CallTransaction.Param[]{
new CallTransaction.Param(true, Fields.BTC_TX_HASH, SolidityType.getType(SolidityType.BYTES32)),
new CallTransaction.Param(false, Fields.REASON, SolidityType.getType(SolidityType.INT256))
}
),
UNREFUNDABLE_PEGIN("unrefundable_pegin",
new CallTransaction.Param[]{
new CallTransaction.Param(true, Fields.BTC_TX_HASH, SolidityType.getType(SolidityType.BYTES32)),
new CallTransaction.Param(false, Fields.REASON, SolidityType.getType(SolidityType.INT256))
}
),
UPDATE_COLLECTIONS("update_collections",
new CallTransaction.Param[]{
new CallTransaction.Param(false, Fields.SENDER, SolidityType.getType(SolidityType.ADDRESS))
}
),
ADD_SIGNATURE("add_signature",
new CallTransaction.Param[]{
new CallTransaction.Param(true, Fields.RELEASE_RSK_TX_HASH, SolidityType.getType(SolidityType.BYTES32)),
new CallTransaction.Param(true, "federatorRskAddress", SolidityType.getType(SolidityType.ADDRESS)),
new CallTransaction.Param(false, "federatorBtcPublicKey", SolidityType.getType(SolidityType.BYTES))
}
),
RELEASE_BTC("release_btc",
new CallTransaction.Param[]{
new CallTransaction.Param(true, Fields.RELEASE_RSK_TX_HASH, SolidityType.getType(SolidityType.BYTES32)),
new CallTransaction.Param(false, "btcRawTransaction", SolidityType.getType(SolidityType.BYTES))
}
),
COMMIT_FEDERATION("commit_federation",
new CallTransaction.Param[]{
new CallTransaction.Param(false, "oldFederationBtcPublicKeys", SolidityType.getType(SolidityType.BYTES)),
new CallTransaction.Param(false, "oldFederationBtcAddress", SolidityType.getType(SolidityType.STRING)),
new CallTransaction.Param(false, "newFederationBtcPublicKeys", SolidityType.getType(SolidityType.BYTES)),
new CallTransaction.Param(false, "newFederationBtcAddress", SolidityType.getType(SolidityType.STRING)),
new CallTransaction.Param(false, "activationHeight", SolidityType.getType(SolidityType.INT256))
}
),
RELEASE_REQUESTED("release_requested",
new CallTransaction.Param[]{
new CallTransaction.Param(true, "rskTxHash", SolidityType.getType(SolidityType.BYTES32)),
new CallTransaction.Param(true, Fields.BTC_TX_HASH, SolidityType.getType(SolidityType.BYTES32)),
new CallTransaction.Param(false, Fields.AMOUNT, SolidityType.getType(SolidityType.UINT256))
}
),
RELEASE_REQUEST_RECEIVED_LEGACY("release_request_received",
new CallTransaction.Param[]{
new CallTransaction.Param(true, Fields.SENDER, SolidityType.getType(SolidityType.ADDRESS)),
new CallTransaction.Param(false, "btcDestinationAddress", SolidityType.getType(SolidityType.BYTES)),
new CallTransaction.Param(false, Fields.AMOUNT, SolidityType.getType(SolidityType.UINT256))
}
),
RELEASE_REQUEST_REJECTED("release_request_rejected",
new CallTransaction.Param[]{
new CallTransaction.Param(true, Fields.SENDER, SolidityType.getType(SolidityType.ADDRESS)),
new CallTransaction.Param(false, Fields.AMOUNT, SolidityType.getType(SolidityType.UINT256)),
new CallTransaction.Param(false, Fields.REASON, SolidityType.getType(SolidityType.INT256))
}
),
BATCH_PEGOUT_CREATED("batch_pegout_created",
new CallTransaction.Param[]{
new CallTransaction.Param(true, Fields.BTC_TX_HASH, SolidityType.getType(SolidityType.BYTES32)),
new CallTransaction.Param(false, Fields.RELEASE_RSK_TX_HASHES, SolidityType.getType(SolidityType.BYTES))
}
),
RELEASE_REQUEST_RECEIVED("release_request_received",
new CallTransaction.Param[]{
LOCK_BTC("lock_btc", new CallTransaction.Param[] {
new CallTransaction.Param(true, Fields.RECEIVER, SolidityType.getType(SolidityType.ADDRESS)),
new CallTransaction.Param(false, Fields.BTC_TX_HASH, SolidityType.getType(SolidityType.BYTES32)),
new CallTransaction.Param(false, "senderBtcAddress", SolidityType.getType(SolidityType.STRING)),
new CallTransaction.Param(false, Fields.AMOUNT, SolidityType.getType(SolidityType.INT256))
}),
PEGIN_BTC("pegin_btc", new CallTransaction.Param[] {
new CallTransaction.Param(true, Fields.RECEIVER, SolidityType.getType(SolidityType.ADDRESS)),
new CallTransaction.Param(true, Fields.BTC_TX_HASH, SolidityType.getType(SolidityType.BYTES32)),
new CallTransaction.Param(false, Fields.AMOUNT, SolidityType.getType(SolidityType.INT256)),
new CallTransaction.Param(false, "protocolVersion", SolidityType.getType(SolidityType.INT256))
}),
REJECTED_PEGIN("rejected_pegin", new CallTransaction.Param[] {
new CallTransaction.Param(true, Fields.BTC_TX_HASH, SolidityType.getType(SolidityType.BYTES32)),
new CallTransaction.Param(false, Fields.REASON, SolidityType.getType(SolidityType.INT256))
}),
UNREFUNDABLE_PEGIN("unrefundable_pegin", new CallTransaction.Param[] {
new CallTransaction.Param(true, Fields.BTC_TX_HASH, SolidityType.getType(SolidityType.BYTES32)),
new CallTransaction.Param(false, Fields.REASON, SolidityType.getType(SolidityType.INT256))
}),
UPDATE_COLLECTIONS("update_collections", new CallTransaction.Param[] {
new CallTransaction.Param(false, Fields.SENDER, SolidityType.getType(SolidityType.ADDRESS))
}),
ADD_SIGNATURE("add_signature", new CallTransaction.Param[] {
new CallTransaction.Param(true, Fields.RELEASE_RSK_TX_HASH, SolidityType.getType(SolidityType.BYTES32)),
new CallTransaction.Param(true, "federatorRskAddress", SolidityType.getType(SolidityType.ADDRESS)),
new CallTransaction.Param(false, "federatorBtcPublicKey", SolidityType.getType(SolidityType.BYTES))
}),
RELEASE_BTC("release_btc", new CallTransaction.Param[] {
new CallTransaction.Param(true, Fields.RELEASE_RSK_TX_HASH, SolidityType.getType(SolidityType.BYTES32)),
new CallTransaction.Param(false, "btcRawTransaction", SolidityType.getType(SolidityType.BYTES))
}),
COMMIT_FEDERATION("commit_federation", new CallTransaction.Param[] {
new CallTransaction.Param(false, "oldFederationBtcPublicKeys", SolidityType.getType(SolidityType.BYTES)),
new CallTransaction.Param(false, "oldFederationBtcAddress", SolidityType.getType(SolidityType.STRING)),
new CallTransaction.Param(false, "newFederationBtcPublicKeys", SolidityType.getType(SolidityType.BYTES)),
new CallTransaction.Param(false, "newFederationBtcAddress", SolidityType.getType(SolidityType.STRING)),
new CallTransaction.Param(false, "activationHeight", SolidityType.getType(SolidityType.INT256))
}),
RELEASE_REQUESTED("release_requested", new CallTransaction.Param[] {
new CallTransaction.Param(true, "rskTxHash", SolidityType.getType(SolidityType.BYTES32)),
new CallTransaction.Param(true, Fields.BTC_TX_HASH, SolidityType.getType(SolidityType.BYTES32)),
new CallTransaction.Param(false, Fields.AMOUNT, SolidityType.getType(SolidityType.UINT256))
}),
RELEASE_REQUEST_RECEIVED_LEGACY("release_request_received", new CallTransaction.Param[] {
new CallTransaction.Param(true, Fields.SENDER, SolidityType.getType(SolidityType.ADDRESS)),
new CallTransaction.Param(false, "btcDestinationAddress", SolidityType.getType(SolidityType.STRING)),
new CallTransaction.Param(false, Fields.AMOUNT, SolidityType.getType(SolidityType.UINT256))
}
),
PEGOUT_CONFIRMED("pegout_confirmed",
new CallTransaction.Param[]{
new CallTransaction.Param(true, Fields.BTC_TX_HASH, SolidityType.getType(SolidityType.BYTES32)),
new CallTransaction.Param(false, "pegoutCreationRskBlockNumber", SolidityType.getType(SolidityType.UINT256))
}
),
PEGOUT_TRANSACTION_CREATED("pegout_transaction_created",
new CallTransaction.Param[]{
new CallTransaction.Param(true, Fields.BTC_TX_HASH, SolidityType.getType(SolidityType.BYTES32)),
new CallTransaction.Param(false, Fields.UTXO_OUTPOINT_VALUES, SolidityType.getType(SolidityType.BYTES))
}
);
new CallTransaction.Param(false, Fields.BTC_DESTINATION_ADDRESS, SolidityType.getType(SolidityType.BYTES)),
new CallTransaction.Param(false, Fields.AMOUNT, SolidityType.getType(SolidityType.UINT256))
}),
RELEASE_REQUEST_REJECTED("release_request_rejected", new CallTransaction.Param[] {
new CallTransaction.Param(true, Fields.SENDER, SolidityType.getType(SolidityType.ADDRESS)),
new CallTransaction.Param(false, Fields.AMOUNT, SolidityType.getType(SolidityType.UINT256)),
new CallTransaction.Param(false, Fields.REASON, SolidityType.getType(SolidityType.INT256))
}),
BATCH_PEGOUT_CREATED("batch_pegout_created", new CallTransaction.Param[] {
new CallTransaction.Param(true, Fields.BTC_TX_HASH, SolidityType.getType(SolidityType.BYTES32)),
new CallTransaction.Param(false, Fields.RELEASE_RSK_TX_HASHES, SolidityType.getType(SolidityType.BYTES))
}),
RELEASE_REQUEST_RECEIVED("release_request_received", new CallTransaction.Param[] {
new CallTransaction.Param(true, Fields.SENDER, SolidityType.getType(SolidityType.ADDRESS)),
new CallTransaction.Param(false, Fields.BTC_DESTINATION_ADDRESS, SolidityType.getType(SolidityType.STRING)),
new CallTransaction.Param(false, Fields.AMOUNT, SolidityType.getType(SolidityType.UINT256))
}),
PEGOUT_CONFIRMED("pegout_confirmed", new CallTransaction.Param[] {
new CallTransaction.Param(true, Fields.BTC_TX_HASH, SolidityType.getType(SolidityType.BYTES32)),
new CallTransaction.Param(false, "pegoutCreationRskBlockNumber", SolidityType.getType(SolidityType.UINT256))
}),
PEGOUT_TRANSACTION_CREATED("pegout_transaction_created", new CallTransaction.Param[] {
new CallTransaction.Param(true, Fields.BTC_TX_HASH, SolidityType.getType(SolidityType.BYTES32)),
new CallTransaction.Param(false, Fields.UTXO_OUTPOINT_VALUES, SolidityType.getType(SolidityType.BYTES))
});

private String eventName;
private CallTransaction.Param[] params;
private final String eventName;
private final CallTransaction.Param[] params;

BridgeEvents(String eventName, CallTransaction.Param[] params) {
this.eventName = eventName;
Expand All @@ -128,5 +98,6 @@ private static class Fields {
private static final String RELEASE_RSK_TX_HASH = "releaseRskTxHash";
private static final String RELEASE_RSK_TX_HASHES = "releaseRskTxHashes";
private static final String UTXO_OUTPOINT_VALUES = "utxoOutpointValues";
private static final String BTC_DESTINATION_ADDRESS = "btcDestinationAddress";
}
}
Loading

0 comments on commit 31fdae2

Please sign in to comment.