Skip to content

Commit

Permalink
feat(x/ecocredit): add batch denom to event bridge (#1837)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanchristo committed Mar 21, 2023
1 parent 5c132ff commit 61091a3
Show file tree
Hide file tree
Showing 7 changed files with 234 additions and 82 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v5.0.1](https://github.com/regen-network/regen-ledger/releases/tag/v5.0.1) - 2023-02-23
## [v5.1.0](https://github.com/regen-network/regen-ledger/releases/tag/v5.1.0) - TBD

### General

Expand All @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
#### Added

- [#1785](https://github.com/regen-network/regen-ledger/pull/1785) Add `amount` and `origin_tx` to `EventBridgeReceive`
- [#1837](https://github.com/regen-network/regen-ledger/pull/1837) Add `batch_denom` to `EventBridge`

## [v5.0.0](https://github.com/regen-network/regen-ledger/releases/tag/v5.0.0) - 2023-01-05

Expand Down
147 changes: 114 additions & 33 deletions api/regen/ecocredit/v1/events.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions proto/regen/ecocredit/v1/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ message EventBridge {
//
// Since Revision 1
string owner = 5;

// batch_denom is the credit batch denom.
//
// Since Revision 3
string batch_denom = 6;
}

// EventBridgeReceive is emitted when credits are bridged from another chain.
Expand All @@ -232,9 +237,13 @@ message EventBridgeReceive {
string batch_denom = 2;

// amount is the amount of credits.
//
// Since Revision 3
string amount = 3;

// origin_tx is the transaction from another chain or registry that triggered
// the minting of credits within the credit batch.
//
// Since Revision 3
OriginTx origin_tx = 4;
}
3 changes: 2 additions & 1 deletion x/ecocredit/base/keeper/features/msg_bridge.feature
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ Feature: Msg/Bridge
"recipient": "0x71C7656EC7ab88b098defB751B7401B5f6d8976F",
"contract": "0x6887246668a3b87f54deb3b94ba47a6f63f32985",
"amount": "10",
"owner": "regen1depk54cuajgkzea6zpgkq36tnjwdzv4ak663u6"
"owner": "regen1depk54cuajgkzea6zpgkq36tnjwdzv4ak663u6",
"batch_denom": "C01-001-20200101-20210101-001"
}
"""

Expand Down
11 changes: 6 additions & 5 deletions x/ecocredit/base/keeper/msg_bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,12 @@ func (k Keeper) Bridge(ctx context.Context, req *types.MsgBridge) (*types.MsgBri
}

if err = sdkCtx.EventManager().EmitTypedEvent(&types.EventBridge{
Target: req.Target,
Recipient: req.Recipient,
Contract: batchContract.Contract,
Amount: credit.Amount,
Owner: req.Owner,
Target: req.Target,
Recipient: req.Recipient,
Contract: batchContract.Contract,
Amount: credit.Amount,
Owner: req.Owner,
BatchDenom: credit.BatchDenom,
}); err != nil {
return nil, err
}
Expand Down
Loading

0 comments on commit 61091a3

Please sign in to comment.