Skip to content

Commit 4335f1f

Browse files
committed
feat(valence-contracts): add support for osmosis
1 parent 326f4fb commit 4335f1f

File tree

1 file changed

+29
-16
lines changed

1 file changed

+29
-16
lines changed

flakeModules/valence-contracts.nix

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
{ lib, flake-parts-lib, ... }:
2-
let
1+
{
2+
lib,
3+
flake-parts-lib,
4+
...
5+
}: let
36
inherit (flake-parts-lib) mkPerSystemOption;
47
inherit (lib) types;
5-
6-
in
7-
{
8+
in {
89
_file = ./valence-contracts.nix;
910
imports = [
1011
# Can't use zero-nix.flakeModules.upload-contracts, because it causes
@@ -13,11 +14,14 @@ in
1314
];
1415

1516
options.perSystem = mkPerSystemOption (
16-
{ config, system, options, ... }:
17-
let
18-
cfg = config.valence-contracts;
19-
in
2017
{
18+
config,
19+
system,
20+
options,
21+
...
22+
}: let
23+
cfg = config.valence-contracts;
24+
in {
2125
options.valence-contracts.upload = lib.mkEnableOption ''
2226
Setup all valence contracts from latest stable release to be uploaded.
2327
'';
@@ -36,7 +40,7 @@ in
3640
Valence contract builds to add to packages output.
3741
'';
3842
default = {};
39-
type = types.attrsOf (types.submodule ({ name, ... }: {
43+
type = types.attrsOf (types.submodule ({name, ...}: {
4044
options = {
4145
src = lib.mkOption {
4246
type = types.path;
@@ -86,7 +90,7 @@ in
8690
upload-contracts.default-inputs = {
8791
inherit (cfg.default-inputs) cosmos-nix zero-nix;
8892
};
89-
upload-contracts.network-defaults.chain-defaults = { config, ... }: {
93+
upload-contracts.network-defaults.chain-defaults = {config, ...}: {
9094
contracts = lib.mkMerge [
9195
# Contract paths are inferred based on name
9296
# but can be manually set with the `path` option within each contract
@@ -101,6 +105,12 @@ in
101105
valence_astroport_withdrawer = {};
102106
valence_generic_ibc_transfer_library = {};
103107
}
108+
(lib.mkIf (config.package.pname == "osmosis") {
109+
valence_osmosis_cl_lper = {};
110+
valence_osmosis_cl_withdrawer = {};
111+
valence_osmosis_gamm_lper = {};
112+
valence_osmosis_gamm_withdrawer = {};
113+
})
104114
(lib.mkIf (config.package.pname == "neutron") {
105115
# All contracts that are specific to neutron
106116
valence_authorization = {};
@@ -113,11 +123,14 @@ in
113123
};
114124
})
115125
{
116-
packages = lib.mapAttrs' (name: buildAttrs: {
117-
name = "valence-contracts-${buildAttrs.version}";
118-
value = cfg.default-inputs.zero-nix.tools.${system}.buildValenceContracts buildAttrs;
119-
}) config.valence-contracts.builds;
126+
packages =
127+
lib.mapAttrs' (name: buildAttrs: {
128+
name = "valence-contracts-${buildAttrs.version}";
129+
value = cfg.default-inputs.zero-nix.tools.${system}.buildValenceContracts buildAttrs;
130+
})
131+
config.valence-contracts.builds;
120132
}
121133
];
122-
});
134+
}
135+
);
123136
}

0 commit comments

Comments
 (0)