Skip to content

Commit a1dfbb9

Browse files
authored
Fix lints + format (#50)
* formatting + fixing lints on tests * formatting + fixing lints on source code * make CI stricter * unmut * remove build strictness * ci
1 parent 53b62a0 commit a1dfbb9

20 files changed

+2663
-2184
lines changed

.github/workflows/pull-request.yml

+3
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,8 @@ jobs:
2020
- name: install git
2121
run: apt-get install -y git
2222

23+
- name: build
24+
run: cd contracts/suilend && sui move build
25+
2326
- name: test
2427
run: cd contracts/suilend && sui move test

contracts/suilend/Move.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[move]
44
version = 3
5-
manifest_digest = "E1B32CD02102E7B9E19A5E7293F67188F052E87A415F5A3936C826988518BBBE"
5+
manifest_digest = "E25F888B3CC57B28D0C772334DD30911CD5A1F9E4F24D8EC7733F5B434BF5012"
66
deps_digest = "F9B494B64F0615AED0E98FC12A85B85ECD2BC5185C22D30E7F67786BB52E507C"
77
dependencies = [
88
{ id = "Pyth", name = "Pyth" },
@@ -67,6 +67,6 @@ dependencies = [
6767
]
6868

6969
[move.toolchain-version]
70-
compiler-version = "1.39.4"
70+
compiler-version = "1.35.3"
7171
edition = "2024.beta"
7272
flavor = "sui"

contracts/suilend/sources/cell.move

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
module suilend::cell {
2-
use std::option::{Self, Option};
3-
42
public struct Cell<Element> has store {
5-
element: Option<Element>
3+
element: Option<Element>,
64
}
75

86
public fun new<Element>(element: Element): Cell<Element> {

contracts/suilend/sources/decimal.move

+32-13
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,37 @@ module suilend::decimal {
44
const WAD: u256 = 1000000000000000000;
55
const U64_MAX: u256 = 18446744073709551615;
66

7-
public struct Decimal has copy, store, drop {
8-
value: u256
7+
public struct Decimal has copy, drop, store {
8+
value: u256,
99
}
1010

1111
public fun from(v: u64): Decimal {
1212
Decimal {
13-
value: (v as u256) * WAD
13+
value: (v as u256) * WAD,
1414
}
1515
}
1616

1717
public fun from_percent(v: u8): Decimal {
1818
Decimal {
19-
value: (v as u256) * WAD / 100
19+
value: (v as u256) * WAD / 100,
2020
}
2121
}
2222

2323
public fun from_percent_u64(v: u64): Decimal {
2424
Decimal {
25-
value: (v as u256) * WAD / 100
25+
value: (v as u256) * WAD / 100,
2626
}
2727
}
2828

2929
public fun from_bps(v: u64): Decimal {
3030
Decimal {
31-
value: (v as u256) * WAD / 10_000
31+
value: (v as u256) * WAD / 10_000,
3232
}
3333
}
3434

3535
public fun from_scaled_val(v: u256): Decimal {
3636
Decimal {
37-
value: v
37+
value: v,
3838
}
3939
}
4040

@@ -44,13 +44,13 @@ module suilend::decimal {
4444

4545
public fun add(a: Decimal, b: Decimal): Decimal {
4646
Decimal {
47-
value: a.value + b.value
47+
value: a.value + b.value,
4848
}
4949
}
5050

5151
public fun sub(a: Decimal, b: Decimal): Decimal {
5252
Decimal {
53-
value: a.value - b.value
53+
value: a.value - b.value,
5454
}
5555
}
5656

@@ -64,13 +64,13 @@ module suilend::decimal {
6464

6565
public fun mul(a: Decimal, b: Decimal): Decimal {
6666
Decimal {
67-
value: (a.value * b.value) / WAD
67+
value: (a.value * b.value) / WAD,
6868
}
6969
}
7070

7171
public fun div(a: Decimal, b: Decimal): Decimal {
7272
Decimal {
73-
value: (a.value * WAD) / b.value
73+
value: (a.value * WAD) / b.value,
7474
}
7575
}
7676

@@ -144,7 +144,23 @@ module suilend::decimal {
144144

145145
#[test_only]
146146
module suilend::decimal_tests {
147-
use suilend::decimal::{add, sub, mul, div, floor, ceil, pow, lt, gt, le, ge, from, from_percent, saturating_sub, saturating_floor};
147+
use suilend::decimal::{
148+
add,
149+
sub,
150+
mul,
151+
div,
152+
floor,
153+
ceil,
154+
pow,
155+
lt,
156+
gt,
157+
le,
158+
ge,
159+
from,
160+
from_percent,
161+
saturating_sub,
162+
saturating_floor
163+
};
148164

149165
#[test]
150166
fun test_basic() {
@@ -164,7 +180,10 @@ module suilend::decimal_tests {
164180
assert!(saturating_sub(a, b) == from(0), 0);
165181
assert!(saturating_sub(b, a) == from(1), 0);
166182
assert!(saturating_floor(from(18446744073709551615)) == 18446744073709551615, 0);
167-
assert!(saturating_floor(add(from(18446744073709551615), from(1))) == 18446744073709551615, 0);
183+
assert!(
184+
saturating_floor(add(from(18446744073709551615), from(1))) == 18446744073709551615,
185+
0,
186+
);
168187
}
169188

170189
#[test]

0 commit comments

Comments
 (0)