Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(stride) - Define event return structs, rename event types and refactor IBCTransfer event #1926

Merged
merged 3 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
- (osmosis-outpost) [#1915](https://github.com/evmos/evmos/pull/1915) Add Osmosis Outpost interface and ABI.
- (ics20) [#1916](https://github.com/evmos/evmos/pull/1916) Make ICS20 Transfer event a common function.
- (ics20) [#1917](https://github.com/evmos/evmos/pull/1917) Make timeout height a const in the ics20 precompile.
- (stride-outpost) [#1926](https://github.com/evmos/evmos/pull/1926) Refactor event names and definitions.

### Bug Fixes

Expand Down
4 changes: 2 additions & 2 deletions precompiles/outposts/stride/IStrideOutpost.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ interface IStrideOutpost {
/// @param memo The IBC transaction memo.
event IBCTransfer(
address indexed sender,
address indexed receiver,
string indexed receiver,
string sourcePort,
string sourceChannel,
string denom,
Expand Down Expand Up @@ -84,4 +84,4 @@ interface IStrideOutpost {
uint256 amount,
string calldata receiver
) external returns (uint64 nextSequence, bool success);
}
}
4 changes: 2 additions & 2 deletions precompiles/outposts/stride/abi.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
},
{
"indexed": true,
"internalType": "address",
"internalType": "string",
"name": "receiver",
"type": "address"
"type": "string"
},
{
"indexed": false,
Expand Down
12 changes: 6 additions & 6 deletions precompiles/outposts/stride/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import (
)

const (
// EventLiquidStake is the event type emitted on a liquidStake transaction to Autopilot on Stride.
EventLiquidStake = "LiquidStake"
// EventRedeem is the event type emitted on a redeem transaction to Autopilot on Stride.
EventRedeem = "Redeem"
// EventTypeLiquidStake is the event type emitted on a liquidStake transaction to Autopilot on Stride.
EventTypeLiquidStake = "LiquidStake"
// EventTypeRedeem is the event type emitted on a redeem transaction to Autopilot on Stride.
EventTypeRedeem = "Redeem"
)

// EmitLiquidStakeEvent creates a new LiquidStake event on the EVM stateDB.
Expand All @@ -29,7 +29,7 @@ func (p Precompile) EmitLiquidStakeEvent(
amount *big.Int,
) error {
// Prepare the event topics
event := p.ABI.Events[EventLiquidStake]
event := p.ABI.Events[EventTypeLiquidStake]
topics := make([]common.Hash, 3)

// The first topic is always the signature of the event.
Expand Down Expand Up @@ -74,7 +74,7 @@ func (p Precompile) EmitRedeemEvent(
amount *big.Int,
) error {
// Prepare the event topics
event := p.ABI.Events[EventRedeem]
event := p.ABI.Events[EventTypeRedeem]
topics := make([]common.Hash, 3)

// The first topic is always the signature of the event.
Expand Down
15 changes: 15 additions & 0 deletions precompiles/outposts/stride/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,21 @@ const (
StrideBech32Prefix = "stride"
)

// EventLiquidStake is the event type emitted on a liquidStake transaction
type EventLiquidStake struct {
Sender common.Address
Token common.Address
Amount *big.Int
}

// EventRedeem is the event type emitted on a redeem transaction
type EventRedeem struct {
Sender common.Address
Token common.Address
Receiver string
Amount *big.Int
}
fedekunze marked this conversation as resolved.
Show resolved Hide resolved

// StakeIBCPacketMetadata metadata info specific to StakeIBC (e.g. 1-click liquid staking).
// Used to create the memo field for the ICS20 transfer corresponding to Autopilot LiquidStake.
type StakeIBCPacketMetadata struct {
Expand Down