-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.Makefile.toml
62 lines (53 loc) · 1.59 KB
/
schema.Makefile.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
[tasks.generate-all-schemas]
script_runner = "@rust"
script = '''
use std::fs;
use std::process::Command;
fn main() -> std::io::Result<()> {
let _ = fs::remove_dir_all("schema");
let _ = fs::remove_dir_all("schemas");
fs::create_dir("schemas")?;
println!("Done");
let contracts = vec![
"mars-account-nft",
"mars-address-provider",
"mars-credit-manager",
"mars-incentives",
"mars-mock-vault",
"mars-red-bank",
"mars-rewards-collector-base",
"mars-params",
"mars-perps",
"mars-rover-health",
"mars-rover-health-computer",
"mars-swapper-base",
"mars-swapper-osmosis",
"mars-swapper-astroport",
"mars-oracle-osmosis",
"mars-oracle-wasm",
"mars-zapper-base",
"mars-vault",
];
for contract in contracts {
println!("{}", contract);
let output = Command::new("cargo")
.arg("run")
.arg("--package")
.arg(contract)
.arg("--example")
.arg("schema")
.output()
.expect("failed to execute process");
println!("status: {}", output.status);
println!("stdout: {}", String::from_utf8_lossy(&output.stdout));
println!("stderr: {}", String::from_utf8_lossy(&output.stderr));
fs::create_dir(format!("schemas/{}", contract))?;
fs::rename(
format!("schema/{}.json", contract),
format!("schemas/{}/{}.json", contract, contract),
)?;
}
let _ = fs::remove_dir_all("schema");
Ok(())
}
'''