Skip to content

Commit

Permalink
Merge branch 'master' into milad/poc-ft-wasm-extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
miladz68 committed Apr 29, 2024
2 parents f1ee13e + 7dea742 commit d045983
Show file tree
Hide file tree
Showing 58 changed files with 4,024 additions and 1,835 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ vendor
*.iml
go.work*
**/wasm-data/wasm/*
.DS_Store
1 change: 1 addition & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ func New(
// AssetFTKeeper -> WasmKeeper -> BankKeeper -> AssetFTKeeper
&app.WasmKeeper,
app.WasmGovPermissionKeeper,
&app.AccountKeeper,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

Expand Down
27 changes: 15 additions & 12 deletions build/coreum/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ const (
cosmovisorBinaryPath = "bin/cosmovisor"
goCoverFlag = "-cover"
tagsFlag = "-tags"
linkStaticallyLDFlag = "-ldflags=-extldflags=-static"
ldFlagsFlag = "-ldflags"
linkStaticallyValue = "-extldflags=-static"
)

var (
Expand Down Expand Up @@ -52,7 +53,7 @@ func BuildCoredLocally(ctx context.Context, deps build.DepsFunc) error {
CGOEnabled: true,
Flags: []string{
goCoverFlag,
versionFlags,
convertToLdFlags(versionFlags),
tagsFlag + "=" + strings.Join(tagsLocal, ","),
},
})
Expand Down Expand Up @@ -86,8 +87,7 @@ func buildCoredInDocker(
CGOEnabled: true,
Flags: append(
extraFlags,
versionFlags,
linkStaticallyLDFlag,
convertToLdFlags(append(versionFlags, linkStaticallyValue)),
tagsFlag+"="+strings.Join(tagsDocker, ","),
),
})
Expand Down Expand Up @@ -115,8 +115,7 @@ func buildCoredClientInDocker(ctx context.Context, deps build.DepsFunc, targetPl
BinOutputPath: binOutputPath,
CGOEnabled: false,
Flags: []string{
versionFlags,
linkStaticallyLDFlag,
convertToLdFlags(append(versionFlags, linkStaticallyValue)),
tagsFlag + "=" + strings.Join(tagsDocker, ","),
},
})
Expand All @@ -143,15 +142,15 @@ func DownloadDependencies(ctx context.Context, deps build.DepsFunc) error {
return golang.DownloadDependencies(ctx, repoPath, deps)
}

func coredVersionLDFlags(ctx context.Context, buildTags []string) (string, error) {
func coredVersionLDFlags(ctx context.Context, buildTags []string) ([]string, error) {
hash, err := git.DirtyHeadHash(ctx, repoPath)
if err != nil {
return "", err
return nil, err
}

version, err := git.VersionFromTag(ctx, repoPath)
if err != nil {
return "", err
return nil, err
}
if version == "" {
version = hash
Expand All @@ -167,12 +166,12 @@ func coredVersionLDFlags(ctx context.Context, buildTags []string) (string, error
ps["github.com/cosmos/cosmos-sdk/version.BuildTags"] = strings.Join(buildTags, ",")
}

var ldFlags []string
var values []string
for k, v := range ps {
ldFlags = append(ldFlags, fmt.Sprintf("-X %s=%s", k, v))
values = append(values, fmt.Sprintf("-X %s=%s", k, v))
}

return "-ldflags=" + strings.Join(ldFlags, " "), nil
return values, nil
}

func formatProto(ctx context.Context, deps build.DepsFunc) error {
Expand All @@ -182,3 +181,7 @@ func formatProto(ctx context.Context, deps build.DepsFunc) error {
cmd.Dir = filepath.Join(repoPath, "proto", "coreum")
return libexec.Exec(ctx, cmd)
}

func convertToLdFlags(values []string) string {
return "-" + ldFlagsFlag + "=" + strings.Join(values, " ")
}
15 changes: 9 additions & 6 deletions build/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@ module github.com/CoreumFoundation/coreum/build

go 1.21

replace github.com/CoreumFoundation/coreum/v4 => ../
replace (
github.com/CoreumFoundation/coreum/v4 => ../
// Make sure to not bump x/exp dependency without cosmos-sdk updated because their breaking change is not compatible
// with cosmos-sdk v0.47.
// Details: https://github.com/cosmos/cosmos-sdk/issues/18415
golang.org/x/exp => golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb
)

require (
github.com/CoreumFoundation/coreum-tools v0.4.1-0.20240321120602-0a9c50facc68
github.com/CoreumFoundation/coreum/v4 v4.0.0-20240213123712-d7d6a45ddb8f
github.com/CoreumFoundation/crust/build v0.0.0-20240426094746-5f1de170c403
github.com/CoreumFoundation/crust/build v0.0.0-20240426160154-ef0a4b5d93ea
github.com/iancoleman/strcase v0.3.0
github.com/pkg/errors v0.9.1
)
Expand All @@ -22,8 +28,5 @@ require (
github.com/samber/lo v1.39.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
go.uber.org/multierr v1.11.0 // indirect
// Make sure to not bump x/exp dependency without cosmos-sdk updated because their breaking change is not compatible
// with cosmos-sdk v0.47.
// Details: https://github.com/cosmos/cosmos-sdk/issues/18415
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 // indirect
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
)
18 changes: 10 additions & 8 deletions build/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/CoreumFoundation/coreum-tools v0.4.1-0.20240321120602-0a9c50facc68 h1:Tb9avuSQW3smVGrUnDh/Y+ML4eK802UsvJNZHsBgOGg=
github.com/CoreumFoundation/coreum-tools v0.4.1-0.20240321120602-0a9c50facc68/go.mod h1:VD93vCHkxYaT/RhOesXTFgd/GQDW54tr0BqGi5JU1c0=
github.com/CoreumFoundation/crust/build v0.0.0-20240426094746-5f1de170c403 h1:m/gYce0eTEsmJ9WiyBQ0O0Vl/nelOgtq13lVhhNPX38=
github.com/CoreumFoundation/crust/build v0.0.0-20240426094746-5f1de170c403/go.mod h1:nS+zNTGtsK9ComEW/McsAK4XnPLhTsf0wIN5o1grD98=
github.com/CoreumFoundation/crust/build v0.0.0-20240426160154-ef0a4b5d93ea h1:Rk0szAREKByOwg8M+yfg8snu6C2OdP7KjIznrIEk38o=
github.com/CoreumFoundation/crust/build v0.0.0-20240426160154-ef0a4b5d93ea/go.mod h1:nS+zNTGtsK9ComEW/McsAK4XnPLhTsf0wIN5o1grD98=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI=
github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
Expand All @@ -16,17 +17,18 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/samber/lo v1.39.0 h1:4gTz1wUhNYLhFSKl6O+8peW0v2F4BCY034GRpU9WnuA=
github.com/samber/lo v1.39.0/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
Expand All @@ -42,8 +44,8 @@ go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 h1:MGwJjxBy0HJshjDNfLsYO8xppfqWlA5ZT9OhtUUhTNw=
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb h1:xIApU0ow1zwMa2uL1VDNeQlNVFTWMQxZUZCMDy0Q4Us=
golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA=
Expand Down
40 changes: 39 additions & 1 deletion docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- [MintAuthorization](#coreum.asset.ft.v1.MintAuthorization)

- [coreum/asset/ft/v1/event.proto](#coreum/asset/ft/v1/event.proto)
- [EventAmountClawedBack](#coreum.asset.ft.v1.EventAmountClawedBack)
- [EventFrozenAmountChanged](#coreum.asset.ft.v1.EventFrozenAmountChanged)
- [EventIssued](#coreum.asset.ft.v1.EventIssued)
- [EventWhitelistedAmountChanged](#coreum.asset.ft.v1.EventWhitelistedAmountChanged)
Expand Down Expand Up @@ -57,6 +58,7 @@
- [EmptyResponse](#coreum.asset.ft.v1.EmptyResponse)
- [ExtensionSettings](#coreum.asset.ft.v1.ExtensionSettings)
- [MsgBurn](#coreum.asset.ft.v1.MsgBurn)
- [MsgClawback](#coreum.asset.ft.v1.MsgClawback)
- [MsgFreeze](#coreum.asset.ft.v1.MsgFreeze)
- [MsgGloballyFreeze](#coreum.asset.ft.v1.MsgGloballyFreeze)
- [MsgGloballyUnfreeze](#coreum.asset.ft.v1.MsgGloballyUnfreeze)
Expand Down Expand Up @@ -1580,6 +1582,23 @@ the granter's account.



<a name="coreum.asset.ft.v1.EventAmountClawedBack"></a>

### EventAmountClawedBack



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `account` | [string](#string) | | |
| `denom` | [string](#string) | | |
| `amount` | [string](#string) | | |






<a name="coreum.asset.ft.v1.EventFrozenAmountChanged"></a>

### EventFrozenAmountChanged
Expand Down Expand Up @@ -2239,7 +2258,8 @@ Feature defines possible features of fungible token.
| whitelisting | 3 | |
| ibc | 4 | |
| block_smart_contracts | 5 | |
| extensions | 6 | |
| clawback | 6 | |
| extension | 7 | |


<!-- end enums -->
Expand Down Expand Up @@ -2300,6 +2320,23 @@ Feature defines possible features of fungible token.



<a name="coreum.asset.ft.v1.MsgClawback"></a>

### MsgClawback



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `sender` | [string](#string) | | |
| `account` | [string](#string) | | |
| `coin` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | |






<a name="coreum.asset.ft.v1.MsgFreeze"></a>

### MsgFreeze
Expand Down Expand Up @@ -2509,6 +2546,7 @@ Msg defines the Msg service.
| `SetFrozen` | [MsgSetFrozen](#coreum.asset.ft.v1.MsgSetFrozen) | [EmptyResponse](#coreum.asset.ft.v1.EmptyResponse) | `SetFrozen sets the absolute value of frozen amount.` | |
| `GloballyFreeze` | [MsgGloballyFreeze](#coreum.asset.ft.v1.MsgGloballyFreeze) | [EmptyResponse](#coreum.asset.ft.v1.EmptyResponse) | `GloballyFreeze freezes fungible token so no operations are allowed with it before unfrozen. This operation is idempotent so global freeze of already frozen token does nothing.` | |
| `GloballyUnfreeze` | [MsgGloballyUnfreeze](#coreum.asset.ft.v1.MsgGloballyUnfreeze) | [EmptyResponse](#coreum.asset.ft.v1.EmptyResponse) | `GloballyUnfreeze unfreezes fungible token and unblocks basic operations on it. This operation is idempotent so global unfreezing of non-frozen token does nothing.` | |
| `Clawback` | [MsgClawback](#coreum.asset.ft.v1.MsgClawback) | [EmptyResponse](#coreum.asset.ft.v1.EmptyResponse) | `Clawback confiscates a part of fungible tokens from an account to the issuer, only if the clawback feature is enabled on that token.` | |
| `SetWhitelistedLimit` | [MsgSetWhitelistedLimit](#coreum.asset.ft.v1.MsgSetWhitelistedLimit) | [EmptyResponse](#coreum.asset.ft.v1.EmptyResponse) | `SetWhitelistedLimit sets the limit of how many tokens a specific account may hold.` | |
| `UpgradeTokenV1` | [MsgUpgradeTokenV1](#coreum.asset.ft.v1.MsgUpgradeTokenV1) | [EmptyResponse](#coreum.asset.ft.v1.EmptyResponse) | `TokenUpgradeV1 upgrades token to version V1.` | |
| `UpdateParams` | [MsgUpdateParams](#coreum.asset.ft.v1.MsgUpdateParams) | [EmptyResponse](#coreum.asset.ft.v1.EmptyResponse) | `UpdateParams is a governance operation to modify the parameters of the module. NOTE: all parameters must be provided.` | |
Expand Down
3 changes: 2 additions & 1 deletion docs/static/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -9091,7 +9091,8 @@
"whitelisting",
"ibc",
"block_smart_contracts",
"extensions"
"clawback",
"extension"
],
"default": "minting",
"description": "Feature defines possible features of fungible token."
Expand Down
Loading

0 comments on commit d045983

Please sign in to comment.