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

Buyback and Burn #1318

Open
wants to merge 66 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 64 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
6fb2be1
scaffold x/icqoracle
assafmo Dec 5, 2024
76e4c71
icqoracle proto
assafmo Dec 8, 2024
071e676
make proto-all
assafmo Dec 8, 2024
62c093e
boilerplate for x/icqoracle
assafmo Dec 10, 2024
b784b29
osmosis SpotPriceV2 icq boilerplate
assafmo Dec 11, 2024
75b8d79
update icqoracle protos
assafmo Dec 11, 2024
ccf28e3
implement icqoracle query params + sanity checks before callback logic
assafmo Dec 11, 2024
cca478f
icqoracle: implement parsing of spot price from osmosis cl pools
assafmo Dec 11, 2024
24fd9f3
update deps/osmosis to v27.0.0-no-fees
assafmo Dec 12, 2024
d5272cc
init x/auction
assafmo Dec 12, 2024
0ee0478
icqoracle: register codec for msgs
assafmo Dec 12, 2024
1cdcd14
fix update auction to use price multiplier from msg
assafmo Dec 12, 2024
c0eb659
fix error message to include token denom
assafmo Dec 12, 2024
6a3f9d8
inline stats into auction
assafmo Dec 12, 2024
3b16bda
implement cli commands
assafmo Dec 12, 2024
c2863a3
add beneficiary to auction
assafmo Dec 12, 2024
3e29cbf
implement FCFS auction type + rename a bunch of stuff
assafmo Dec 12, 2024
2040e96
rename price_stale_timeout_sec to price_expiration_timeout_sec in icq…
assafmo Dec 13, 2024
1e629dd
move common quote price calculation from auction to icqoracle
assafmo Dec 13, 2024
61710b3
refactor PlaceBid() to use auction bid handlers
assafmo Dec 13, 2024
59b2646
icqoracle: add TokenPriceForQuoteDenom to grpc query service
assafmo Dec 13, 2024
d487cbd
implement module boilerpalte for auction and icqoracle
assafmo Dec 13, 2024
d1724ef
genesis stuff
assafmo Dec 13, 2024
a740fa3
icqoracle: remove unnecessary expected keepers
assafmo Dec 17, 2024
40c4971
Simplifies ICQ oracle API endpoint paths
assafmo Dec 17, 2024
60b2cf0
s/MsgAddTokenPrice/MsgRegisterTokenPriceQuery/g
assafmo Dec 17, 2024
5aa8900
Fix icqoracle amino names
assafmo Dec 17, 2024
6913cd7
s/MsgRemoveTokenPrice/MsgRemoveTokenPriceQuery/g
assafmo Dec 17, 2024
ce9021d
fix required args for remove-token-price cli
assafmo Dec 17, 2024
e48baae
add error logging for osmosis cl pool icq submission failure
assafmo Dec 17, 2024
a0face1
simplify icq data passing
assafmo Dec 17, 2024
b701839
remove unnecessary crap
assafmo Dec 17, 2024
cc4b4b3
fix module.go
assafmo Dec 17, 2024
059505e
update token price key format to use separator
assafmo Dec 17, 2024
c0c1eb9
update auction query endpoints to remove v1beta1 versioning
assafmo Dec 17, 2024
ded8956
Refactor x/auction to support multiple token pairs, and add a unique …
assafmo Dec 17, 2024
a7e0836
Standardizes API endpoints and fix auction queries
assafmo Dec 17, 2024
97cccc7
removes unused bank keeper functions
assafmo Dec 17, 2024
b8c75ca
Adds price mapping description in GetTokenPricesByDenom
assafmo Dec 17, 2024
49ec193
update token price key format to use separator
assafmo Dec 17, 2024
6533e6f
remove unnecessary crap
assafmo Dec 17, 2024
96aea3f
wire auction in app.go
assafmo Dec 17, 2024
06eb44e
Merge branch 'scaffold-x/icqoracle' into x/auction
assafmo Dec 17, 2024
60998fd
x/auction (#1313)
assafmo Dec 17, 2024
6f79877
scaffold x/icqoracle (#1310)
assafmo Dec 17, 2024
02cd50b
x/strdburner proto
assafmo Dec 17, 2024
eaf8d76
x/strdburner initial impl
assafmo Dec 17, 2024
9ec3eb1
add burn event
assafmo Dec 17, 2024
7a539dc
strdburner: improve error logging in endblocker
assafmo Dec 17, 2024
241f69c
fix code comment
assafmo Dec 17, 2024
3976b2d
implement TotalStrdBurned and refactor EndBlocker for readability
assafmo Dec 17, 2024
eb407d1
fix ExactArgs in clis for x/auction
assafmo Dec 17, 2024
2ba4b33
emit event when bid is accepted
assafmo Dec 17, 2024
3e6a23b
Stride Burner Module (#1319)
assafmo Dec 18, 2024
429b985
fix linter ci
assafmo Dec 18, 2024
45bf5a4
fix selling token availability check in fcfs bid handler
assafmo Dec 18, 2024
3f51aa6
impl admin checks
assafmo Dec 18, 2024
4419b8c
improve bool parsing for enabled flag
assafmo Dec 18, 2024
be789ef
change icq timeout policy from retry to reject
assafmo Dec 18, 2024
4188dda
extract auction and price query validation logic into separate functions
assafmo Dec 18, 2024
3390b83
fix ci somehow
assafmo Dec 18, 2024
59a9e78
rename price_multiplier to min_price_multiplier
assafmo Dec 19, 2024
3b9150f
refactor auction and oracle store to use prefix store
assafmo Dec 19, 2024
4fd74d4
make ts-tests work again after some changes have me made to stridejs'…
assafmo Dec 19, 2024
75b49d1
wire x/strdburner in app.go
assafmo Dec 22, 2024
bf2d024
Add v25 upgrade handler
assafmo Dec 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
path = deps/juno
url = https://github.com/CosmosContracts/juno.git
[submodule "deps/osmosis"]
# Commit: v20.5.0-no-fees
# Commit: v27.0.0-no-fees
path = deps/osmosis
url = https://github.com/Stride-Labs/osmosis.git
[submodule "deps/stargaze"]
Expand Down
37 changes: 37 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ import (
airdrop "github.com/Stride-Labs/stride/v24/x/airdrop"
airdropkeeper "github.com/Stride-Labs/stride/v24/x/airdrop/keeper"
airdroptypes "github.com/Stride-Labs/stride/v24/x/airdrop/types"
"github.com/Stride-Labs/stride/v24/x/auction"
auctionkeeper "github.com/Stride-Labs/stride/v24/x/auction/keeper"
auctiontypes "github.com/Stride-Labs/stride/v24/x/auction/types"

"github.com/Stride-Labs/stride/v24/x/autopilot"
autopilotkeeper "github.com/Stride-Labs/stride/v24/x/autopilot/keeper"
autopilottypes "github.com/Stride-Labs/stride/v24/x/autopilot/types"
Expand All @@ -146,6 +150,9 @@ import (
icaoracle "github.com/Stride-Labs/stride/v24/x/icaoracle"
icaoraclekeeper "github.com/Stride-Labs/stride/v24/x/icaoracle/keeper"
icaoracletypes "github.com/Stride-Labs/stride/v24/x/icaoracle/types"
icqoracle "github.com/Stride-Labs/stride/v24/x/icqoracle"
icqoraclekeeper "github.com/Stride-Labs/stride/v24/x/icqoracle/keeper"
icqoracletypes "github.com/Stride-Labs/stride/v24/x/icqoracle/types"
"github.com/Stride-Labs/stride/v24/x/interchainquery"
interchainquerykeeper "github.com/Stride-Labs/stride/v24/x/interchainquery/keeper"
interchainquerytypes "github.com/Stride-Labs/stride/v24/x/interchainquery/types"
Expand Down Expand Up @@ -236,6 +243,8 @@ var (
ibchooks.AppModuleBasic{},
ibcwasm.AppModuleBasic{},
airdrop.AppModuleBasic{},
icqoracle.AppModuleBasic{},
auction.AppModuleBasic{},
)

// module account permissions
Expand Down Expand Up @@ -348,6 +357,8 @@ type StrideApp struct {
StaketiaKeeper staketiakeeper.Keeper
StakedymKeeper stakedymkeeper.Keeper
AirdropKeeper airdropkeeper.Keeper
ICQOracleKeeper icqoraclekeeper.Keeper
AuctionKeeper auctionkeeper.Keeper

mm *module.Manager
sm *module.SimulationManager
Expand Down Expand Up @@ -404,6 +415,8 @@ func NewStrideApp(
ibchookstypes.StoreKey,
ibcwasmtypes.StoreKey,
airdroptypes.StoreKey,
icqoracletypes.StoreKey,
auctiontypes.StoreKey,
)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
Expand Down Expand Up @@ -757,6 +770,21 @@ func NewStrideApp(
app.AccountKeeper, app.BankKeeper, app.DistrKeeper, app.StakingKeeper,
)

app.ICQOracleKeeper = *icqoraclekeeper.NewKeeper(
appCodec,
keys[icqoracletypes.StoreKey],
)
icqOracleModule := icqoracle.NewAppModule(appCodec, app.ICQOracleKeeper)

app.AuctionKeeper = *auctionkeeper.NewKeeper(
appCodec,
keys[auctiontypes.StoreKey],
app.AccountKeeper,
app.BankKeeper,
app.ICQOracleKeeper,
)
auctionModule := auction.NewAppModule(appCodec, app.AuctionKeeper)

// Register Gov (must be registered after stakeibc)
govRouter := govtypesv1beta1.NewRouter()
govRouter.AddRoute(govtypes.RouterKey, govtypesv1beta1.ProposalHandler).
Expand Down Expand Up @@ -933,6 +961,9 @@ func NewStrideApp(
stakeTiaModule,
stakeDymModule,
airdropModule,
stakeTiaModule,
icqOracleModule,
auctionModule,
)

// During begin block slashing happens after distr.BeginBlocker so that
Expand Down Expand Up @@ -978,6 +1009,8 @@ func NewStrideApp(
ibchookstypes.ModuleName,
ibcwasmtypes.ModuleName,
airdroptypes.ModuleName,
icqoracletypes.ModuleName,
auctiontypes.ModuleName,
)

app.mm.SetOrderEndBlockers(
Expand Down Expand Up @@ -1019,6 +1052,8 @@ func NewStrideApp(
ibchookstypes.ModuleName,
ibcwasmtypes.ModuleName,
airdroptypes.ModuleName,
icqoracletypes.ModuleName,
auctiontypes.ModuleName,
)

// NOTE: The genutils module must occur after staking so that pools are
Expand Down Expand Up @@ -1065,6 +1100,8 @@ func NewStrideApp(
ibchookstypes.ModuleName,
ibcwasmtypes.ModuleName,
airdroptypes.ModuleName,
icqoracletypes.ModuleName,
auctiontypes.ModuleName,
)

app.mm.RegisterInvariants(app.CrisisKeeper)
Expand Down
2 changes: 1 addition & 1 deletion deps/osmosis
Submodule osmosis updated 1547 files
18 changes: 9 additions & 9 deletions dockernet/dockerfiles/Dockerfile.osmo
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM golang:1.20-alpine3.16 AS builder
FROM golang:1.23-alpine3.21 AS builder

WORKDIR /opt/

RUN set -eux; apk add --no-cache ca-certificates build-base; apk add git linux-headers

ENV COMMIT_HASH=v20.5.0-no-fees
ENV COMMIT_HASH=v27.0.0-no-fees

RUN git clone https://github.com/Stride-Labs/osmosis.git \
&& cd osmosis \
Expand All @@ -13,16 +13,16 @@ RUN git clone https://github.com/Stride-Labs/osmosis.git \
WORKDIR /opt/osmosis

# Cosmwasm - download correct libwasmvm version and verify checksum
# Note: checksum not available for v1.2.3, otherwise command should be
# wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/checksums.txt -O /tmp/checksums.txt
# && sha256sum /lib/libwasmvm_muslc.a | grep $(cat /tmp/checksums.txt | grep $(uname -m) | cut -d ' ' -f 1)
RUN WASMVM_VERSION=v1.2.3 \
&& wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/libwasmvm_muslc.$(uname -m).a \
-O /lib/libwasmvm_muslc.a
RUN ARCH=$(uname -m) && WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm/v2 | sed 's/.* //') && \
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/libwasmvm_muslc.$ARCH.a \
-O /lib/libwasmvm_muslc.$ARCH.a && \
# verify checksum
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/checksums.txt -O /tmp/checksums.txt && \
sha256sum /lib/libwasmvm_muslc.$ARCH.a | grep $(cat /tmp/checksums.txt | grep libwasmvm_muslc.$ARCH | cut -d ' ' -f 1)

RUN BUILD_TAGS=muslc LINK_STATICALLY=true make build

FROM alpine:3.16
FROM alpine:3.21
COPY --from=builder /opt/osmosis/build/osmosisd /usr/local/bin/
RUN apk add bash vim \
&& addgroup -g 1000 osmosis \
Expand Down
4 changes: 3 additions & 1 deletion dockernet/ts-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

```bash
# build stride locally and run dokcernet
(cd ../.. && make sync && make start-docker build=sgr)
(cd ../.. && make sync && make start-docker build=sgro)

# install deps
pnpm i
Expand All @@ -23,9 +23,11 @@ IMPORTANT: `@cosmjs/*` dependencies must match the versions used by stridejs. To
### test new protobufs

- go to https://github.com/Stride-Labs/stridejs
- remove `/dist` from `.gitignore`
- update the config in `scripts/clone_repos.ts` to point to the new `stride/cosmos-sdk/ibc-go` version
- run `pnpm i`
- run `pnpm codegen`
- run `pnpm build`
- run `git commit...`
- run `git push`
- get the current `stridejs` commit using `git rev-parse HEAD`
Expand Down
7 changes: 4 additions & 3 deletions dockernet/ts-tests/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"name": "stride-integration-tests",
"version": "1.0.0",
"type": "module",
"description": "integration tests for stride chain",
"scripts": {
"test": "vitest run",
"test-watch": "vitest watch"
"test": "NODE_OPTIONS=--conditions=node vitest run",
"test-watch": "NODE_OPTIONS=--conditions=node vitest watch"
},
"keywords": [
"wow",
Expand All @@ -25,7 +26,7 @@
"bech32": "2.0.0",
"jest": "29.7.0",
"prettier": "3.3.3",
"stridejs": "github:Stride-Labs/stridejs#e17c404f6451bad95ef0093f2b41244248bd7ebd",
"stridejs": "github:Stride-Labs/stridejs#e949e35",
"typescript": "5.5.3",
"vitest": "2.0.3"
},
Expand Down
26 changes: 6 additions & 20 deletions dockernet/ts-tests/pnpm-lock.yaml

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

11 changes: 6 additions & 5 deletions dockernet/ts-tests/test/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,13 @@ describe("x/airdrop", () => {
}
expect(tx.code).toBe(0);

const { airdrop } = await stridejs.query.stride.airdrop.airdrop({
id: airdropId,
});
const { id, earlyClaimPenalty } =
await stridejs.query.stride.airdrop.airdrop({
id: airdropId,
});

expect(airdrop!.id).toBe(airdropId);
expect(airdrop!.earlyClaimPenalty).toBe("0.5");
expect(id).toBe(airdropId);
expect(earlyClaimPenalty).toBe("0.5");
});
});

Expand Down
26 changes: 26 additions & 0 deletions dockernet/ts-tests/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
globals: true,
environment: "node",
testTimeout: 30000,
hookTimeout: 30000,
pool: "forks",
poolOptions: {
forks: {
singleFork: true,
},
},
server: {
deps: {
inline: ["stridejs"],
},
},
},
resolve: {
alias: {
stridejs: "stridejs/dist/esm", // Force ESM path
},
},
});
60 changes: 60 additions & 0 deletions proto/stride/auction/auction.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
syntax = "proto3";
package stride.auction;

import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";

option go_package = "github.com/Stride-Labs/stride/v24/x/auction/types";

enum AuctionType {
// Default value - should not be used
AUCTION_TYPE_UNSPECIFIED = 0;
// First-Come First-Served auction
AUCTION_TYPE_FCFS = 1;
}
message Params {}

message Auction {
// Auction type
AuctionType type = 1;

// A unique auction name
string name = 2;

// Token denom being sold in the auction
string selling_denom = 3;

// Token denom used to place bids
string payment_denom = 4;

// Whether auction is active
bool enabled = 5;

// Minimum price multiplier (e.g. 0.95 for 5% discount off the oracle price)
// bids_floor_price = oracle_price * min_price_multiplier
string min_price_multiplier = 6 [
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
(gogoproto.nullable) = false
];

// Minimum payment token bid amount
string min_bid_amount = 7 [
(gogoproto.customtype) = "cosmossdk.io/math.Int",
(gogoproto.nullable) = false
];

// Address to send the auction proceeds to
string beneficiary = 8 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];

// Total amount of payment token received
string total_payment_token_received = 9 [
(gogoproto.customtype) = "cosmossdk.io/math.Int",
(gogoproto.nullable) = false
];

// Total amount of selling token sold
string total_selling_token_sold = 10 [
(gogoproto.customtype) = "cosmossdk.io/math.Int",
(gogoproto.nullable) = false
];
}
Loading
Loading