Skip to content

Commit

Permalink
Merge pull request #457 from ixofoundation/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Michael-Ixo authored Nov 28, 2024
2 parents cbfe5c2 + 1b84e7b commit 0c69a80
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 44 deletions.
27 changes: 10 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,33 +1,28 @@
# echo $(git describe --tags) | sed 's/^v//'

ARG GO_VERSION="1.22"
# ARG RUNNER_IMAGE="ubuntu:latest"
ARG RUNNER_IMAGE="gcr.io/distroless/static-debian11"
ARG RUNNER_IMAGE="ubuntu:latest"
# ARG RUNNER_IMAGE="gcr.io/distroless/static-debian11"
ARG BUILD_TAGS="netgo,ledger,muslc"

# --------------------------------------------------------
# Builder
# --------------------------------------------------------

FROM golang:${GO_VERSION}-alpine3.18 AS builder
FROM golang:${GO_VERSION}-alpine3.20 AS builder

# TODO: maybe extract below args to where called in cicd?
# git log -1 --format='%H'
ARG GIT_VERSION="4.0.0-rc.0"
ARG GIT_COMMIT="ca9e64cf2f8c29b8bb001281abcdcb942dc9fa01"
ARG GIT_VERSION="v4.0.0"
ARG GIT_COMMIT="cbfe5c259cad5b192e6b6353879e80b1e8f2abd8"

RUN apk add --no-cache \
ca-certificates \
build-base \
linux-headers \
binutils-gold
ENV PACKAGES="ca-certificates build-base binutils-gold curl make git libc-dev bash file gcc linux-headers eudev-dev"
RUN apk add --no-cache $PACKAGES

# Download go dependencies
WORKDIR /ixo
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/root/go/pkg/mod \
go mod download
RUN go mod download

# RUN ARCH=$(uname -m)
# Cosmwasm - Download correct libwasmvm version
Expand All @@ -40,17 +35,15 @@ RUN ARCH=x86_64 && WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | sed
COPY . .

# Build ixod binary
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/root/go/pkg/mod \
GOWORK=off go build \
RUN GOWORK=off go build \
-mod=readonly \
-tags "netgo,ledger,muslc" \
-ldflags \
"-X github.com/cosmos/cosmos-sdk/version.Name="ixo" \
-X github.com/cosmos/cosmos-sdk/version.AppName="ixod" \
-X github.com/cosmos/cosmos-sdk/version.Version=${GIT_VERSION} \
-X github.com/cosmos/cosmos-sdk/version.Commit=${GIT_COMMIT} \
-X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger,muslc \
-X github.com/cosmos/cosmos-sdk/version.BuildTags=${BUILD_TAGS} \
-w -s -linkmode=external -extldflags '-Wl,-z,muldefs --static -lm'" \
-trimpath \
-o /ixo/build/ixod \
Expand Down
20 changes: 8 additions & 12 deletions app/upgrades/v4/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,37 +41,33 @@ const (
// IsSmartAccountActive is used for the smart account circuit breaker, smartaccounts are activated for v4
IsSmartAccountActive = true
// CircuitBreakerController is a DAODAO address, used only to deactivate the smart account module
// https://daodao.zone/dao/osmo1wn58hxkv0869ua7qmz3gvek3sz773l89a778fjqvenl6anwuhgnq6ks7kl/home
CircuitBreakerController = "ixo1kqmtxkggcqa9u34lnr6shy0euvclgatw4f9zz5"
CircuitBreakerController = "ixo15rwc9v3jfvypve8zemdr7y68dydsrh9m2urvjn"
)

var (
// LIQUID STAKE PARAMS
// -------------------------------------------------
// total weights must be 10000
WhitelistedValidators = []liquidstaketypes.WhitelistedValidator{
// Launchpad Validator to start with
{
ValidatorAddress: "ixovaloper1n8yrmeatsk74dw0zs95ess9sgzptd6thzncf20",
TargetWeight: math.NewIntFromUint64(5000),
},
{
ValidatorAddress: "ixovaloper1n8yrmeatsk74dw0zs95ess9sgzptd6thzncf20",
TargetWeight: math.NewIntFromUint64(5000),
ValidatorAddress: "ixovaloper1kr8v9qt46ysltgmzcrtgyw5ckke83up673u2lu",
TargetWeight: math.NewIntFromUint64(10000),
},
}
// LSMUnstakeFeeRate is the Unstake Fee Rate. (note the fee amount stays as staked amount in proxy account, it is not
// instaked and transferred to the FeeAccountAddress)
LSMUnstakeFeeRate = math.LegacyNewDecWithPrec(3333, 4) // "0.333300000000000000"
LSMUnstakeFeeRate = math.LegacyZeroDec()
// LSMAutocompoundFeeRate is the fee rate for auto redelegating the stake rewards.
LSMAutocompoundFeeRate = math.LegacyNewDecWithPrec(3333, 4) // "0.333300000000000000"
LSMAutocompoundFeeRate = math.LegacyZeroDec()
// LSMWhitelistAdminAddress is the address of the whitelist admin, who is allowed to add/remove whitelisted validators,
// pause/unpause the liquid stake module, and set the weighted rewards receivers.
LSMWhitelistAdminAddress = "ixo1kqmtxkggcqa9u34lnr6shy0euvclgatw4f9zz5"
LSMWhitelistAdminAddress = "ixo15rwc9v3jfvypve8zemdr7y68dydsrh9m2urvjn"
// LSMWeightedRewardsReceivers is the list of weighted rewards receivers who will recieve the staking rewards based
// on their weights.
LSMWeightedRewardsReceivers = []liquidstaketypes.WeightedAddress{}
// LSMFeeAccountAddress is the address of the fee account, which will receive the autocompound fees.
LSMFeeAccountAddress = "ixo1kqmtxkggcqa9u34lnr6shy0euvclgatw4f9zz5"
LSMFeeAccountAddress = "ixo15rwc9v3jfvypve8zemdr7y68dydsrh9m2urvjn"

// STAKING PARAMS
// -------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions x/epochs/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ func NewGenesisState(epochs []EpochInfo) *GenesisState {
// DefaultGenesis returns the default Capability genesis state.
func DefaultGenesis() *GenesisState {
epochs := []EpochInfo{
// TODO: comment out 2min, used for testing
NewGenesisEpochInfo("2min", time.Minute*2), // alphabetical order
// TODO: comment out 2min, used for local testing
// NewGenesisEpochInfo("2min", time.Minute*2), // alphabetical order
NewGenesisEpochInfo("day", time.Hour*24),
NewGenesisEpochInfo("hour", time.Hour),
NewGenesisEpochInfo("week", time.Hour*24*7),
Expand Down
5 changes: 5 additions & 0 deletions x/liquidstake/keeper/liquidstake.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ func (k Keeper) LiquidStake(
) (stkIXOMintAmount math.Int, err error) {
params := k.GetParams(ctx)

// only allow the whitelistedAdminAddress to do liquid staking, this might be removed later
if params.WhitelistAdminAddress != liquidStaker.String() {
return math.ZeroInt(), types.ErrRestrictedToWhitelistedAdminAddress
}

if params.ModulePaused {
return math.ZeroInt(), types.ErrModulePaused
}
Expand Down
1 change: 0 additions & 1 deletion x/liquidstake/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ func NewMsgServerImpl(keeper Keeper) types.MsgServer {
return &msgServer{Keeper: keeper}
}

// TODO: only zero dao should be able to liquid stake
// --------------------------
// LIQUID STAKE
// --------------------------
Expand Down
2 changes: 1 addition & 1 deletion x/liquidstake/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw
}

// BeginBlock executes all ABCI BeginBlock logic respective to the capability module.
func (am AppModule) BeginBlock(context sdk.Context) error {
func (am AppModule) BeginBlock(context context.Context) error {
ctx := sdk.UnwrapSDKContext(context)
BeginBlock(ctx, am.keeper)
return nil
Expand Down
1 change: 1 addition & 0 deletions x/liquidstake/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ var (
ErrUnstakeFailed = errors.Register(ModuleName, 18, "Unstaking failed")
ErrRedelegateFailed = errors.Register(ModuleName, 19, "Redelegate failed")
ErrRatioMoreThanOne = errors.Register(ModuleName, 20, "ratio should be less than or equal to 1")
ErrRestrictedToWhitelistedAdminAddress = errors.Register(ModuleName, 21, "this action is restricted to only the whitelisted admin address")
)
10 changes: 5 additions & 5 deletions x/liquidstake/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ const (
StoreKey = ModuleName

// Epoch identifiers
// TODO: comment out 2min it is for local testing
AutocompoundEpoch = "2min"
RebalanceEpoch = "2min"
// AutocompoundEpoch = "hour"
// RebalanceEpoch = "day"
// TODO: comment out 2min, used for local testing
// AutocompoundEpoch = "2min"
// RebalanceEpoch = "2min"
AutocompoundEpoch = "hour"
RebalanceEpoch = "day"
)

var (
Expand Down
12 changes: 6 additions & 6 deletions x/mint/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ func DefaultParams() Params {
return Params{
MintDenom: ixo.IxoNativeToken,
GenesisEpochProvisions: ixomath.NewDec(43_500_000_000), // 43_500 IXO
// TODO: comment out 2min and uncomment day, 2min is for local testing
EpochIdentifier: "2min", // 2 min
ReductionPeriodInEpochs: 1000000, // 14 min
// EpochIdentifier: "day", // 1 day
// ReductionPeriodInEpochs: 365, // 1 years
ReductionFactor: ixomath.NewDecWithPrec(666666666666666666, 18), // 0.666666666666666666
// TODO: comment out 2min, used for local testing
// EpochIdentifier: "2min", // 2 min
// ReductionPeriodInEpochs: 1000000, // 14 min
EpochIdentifier: "day", // 1 day
ReductionPeriodInEpochs: 365, // 1 years
ReductionFactor: ixomath.NewDecWithPrec(666666666666666666, 18), // 0.666666666666666666
DistributionProportions: DistributionProportions{
Staking: ixomath.NewDecWithPrec(1, 0), // 1.0
ImpactRewards: ixomath.NewDecWithPrec(0, 1), // 0.0
Expand Down

0 comments on commit 0c69a80

Please sign in to comment.