Skip to content

Commit facfc85

Browse files
committed
chore(target_chains/sui): add some misc files and fixes
math lib is deprecated.
1 parent 0526bd8 commit facfc85

File tree

3 files changed

+58
-3
lines changed

3 files changed

+58
-3
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[package]
2+
name = "Pyth"
3+
version = "0.0.2"
4+
published-at = "0x23994dd119480ea614f7623520337058dca913cb1bb6e5d8d51c7b067d3ca3bb"
5+
6+
[dependencies.Iota]
7+
git = "https://github.com/iotaledger/iota.git"
8+
subdir = "crates/iota-framework/packages/iota-framework"
9+
rev = "751c23caf24efd071463b9ffd07eabcb15f44f31"
10+
11+
[dependencies.Wormhole]
12+
local = "../vendor/wormhole_iota_testnet/wormhole"
13+
14+
[addresses]
15+
pyth = "0x23994dd119480ea614f7623520337058dca913cb1bb6e5d8d51c7b067d3ca3bb"

target_chains/sui/contracts/sources/governance/set_update_fee.move

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
module pyth::set_update_fee {
2-
use sui::math::{Self};
3-
2+
use std::u64;
43
use wormhole::cursor;
54

65
use pyth::deserialize;
@@ -34,7 +33,7 @@ module pyth::set_update_fee {
3433
}
3534

3635
fun apply_exponent(mantissa: u64, exponent: u8): u64 {
37-
mantissa * math::pow(10, exponent)
36+
mantissa * u64::pow(10, exponent)
3837
}
3938
}
4039

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
# This script patches the SUI code to be compatible with IOTA. IOTA is a fork
6+
# of SUI but is not compatible with SUI. You'd need to run this script for
7+
# deploying Pyth contracts and updating the vendored libs.
8+
#
9+
# Note: Do not commit the patched Pyth code to the repo.
10+
11+
# Check if at least one argument (glob pattern) is provided
12+
if [ $# -lt 1 ]; then
13+
echo "Usage: $0 <glob-pattern>"
14+
exit 1
15+
fi
16+
17+
# Detect OS to determine correct sed syntax. sed --version is not available on macOS/BSD sed.
18+
if sed --version >/dev/null 2>&1; then
19+
SED_CMD=sed
20+
else
21+
if ! command -v gsed >/dev/null 2>&1; then
22+
echo "Error: GNU sed (gsed) is required for macOS/BSD. Install core-utils via Homebrew."
23+
exit 1
24+
fi
25+
26+
SED_CMD=gsed
27+
fi
28+
29+
# Expand glob pattern and iterate over files
30+
for file in $@; do
31+
if [[ -f "$file" ]]; then
32+
echo "Processing: $file"
33+
$SED_CMD -i -e 's/\bSUI\b/IOTA/g' \
34+
-e 's/\bSui\b/Iota/g' \
35+
-e 's/\bsui\b/iota/g' "$file"
36+
else
37+
echo "Skipping: $file (not a regular file)"
38+
fi
39+
done
40+
41+
echo "Replacements complete."

0 commit comments

Comments
 (0)