sdecimal
Module0xca86…d98f
- Move path
- 0x7fd8…1fec::sdecimal
- Functions
- 2424 public, 0 entry
- Structs
- 1
- Friend modules
- None
sdecimal
Bytecode672 lines
The on-chain disassembly. Offsets are bytecode positions within each function.
// Move bytecode v7
module 7fd8aba1652c58b6397c799fd375e748e5053145cb7e126d303e0a1545fd1fec.sdecimal {
use 7fd8aba1652c58b6397c799fd375e748e5053145cb7e126d303e0a1545fd1fec::decimal;
use 7fd8aba1652c58b6397c799fd375e748e5053145cb7e126d303e0a1545fd1fec::rate;
use 7fd8aba1652c58b6397c799fd375e748e5053145cb7e126d303e0a1545fd1fec::srate;
struct SDecimal has copy, drop, store {
is_positive: bool,
value: Decimal
}
public is_zero(Arg0: &SDecimal): bool {
B0:
0MoveLoc[0](Arg0: &SDecimal)
1ImmBorrowField[0](SDecimal.value: Decimal)
2Call decimal::is_zero(&Decimal): bool
3Ret
}
public is_positive(Arg0: &SDecimal): bool {
B0:
0MoveLoc[0](Arg0: &SDecimal)
1ImmBorrowField[1](SDecimal.is_positive: bool)
2ReadRef
3Ret
}
public eq(Arg0: &SDecimal, Arg1: &SDecimal): bool {
L2: loc0: bool
L3: loc1: bool
B0:
0CopyLoc[0](Arg0: &SDecimal)
1ImmBorrowField[0](SDecimal.value: Decimal)
2CopyLoc[1](Arg1: &SDecimal)
3ImmBorrowField[0](SDecimal.value: Decimal)
4Call decimal::eq(&Decimal, &Decimal): bool
5BrFalse(27)
B1:
6CopyLoc[0](Arg0: &SDecimal)
7Call is_zero(&SDecimal): bool
8BrFalse(16)
B2:
9MoveLoc[0](Arg0: &SDecimal)
10Pop
11MoveLoc[1](Arg1: &SDecimal)
12Pop
13LdTrue
14StLoc[2](loc0: bool)
15Branch(24)
B3:
16MoveLoc[0](Arg0: &SDecimal)
17ImmBorrowField[1](SDecimal.is_positive: bool)
18ReadRef
19MoveLoc[1](Arg1: &SDecimal)
20ImmBorrowField[1](SDecimal.is_positive: bool)
21ReadRef
22Eq
23StLoc[2](loc0: bool)
B4:
24MoveLoc[2](loc0: bool)
25StLoc[3](loc1: bool)
26Branch(33)
B5:
27MoveLoc[0](Arg0: &SDecimal)
28Pop
29MoveLoc[1](Arg1: &SDecimal)
30Pop
31LdFalse
32StLoc[3](loc1: bool)
B6:
33MoveLoc[3](loc1: bool)
34Ret
}
public value(Arg0: &SDecimal): Decimal {
B0:
0MoveLoc[0](Arg0: &SDecimal)
1ImmBorrowField[0](SDecimal.value: Decimal)
2ReadRef
3Ret
}
public zero(): SDecimal {
B0:
0LdTrue
1Call decimal::zero(): Decimal
2Pack[0](SDecimal)
3Ret
}
public one(): SDecimal {
B0:
0LdTrue
1Call decimal::one(): Decimal
2Pack[0](SDecimal)
3Ret
}
public from_decimal(Arg0: bool, Arg1: Decimal): SDecimal {
B0:
0MoveLoc[0](Arg0: bool)
1MoveLoc[1](Arg1: Decimal)
2Pack[0](SDecimal)
3Ret
}
public from_srate(Arg0: SRate): SDecimal {
B0:
0ImmBorrowLoc[0](Arg0: SRate)
1Call srate::is_positive(&SRate): bool
2ImmBorrowLoc[0](Arg0: SRate)
3Call srate::value(&SRate): Rate
4Call decimal::from_rate(Rate): Decimal
5Pack[0](SDecimal)
6Ret
}
public to_srate(Arg0: SDecimal): SRate {
B0:
0ImmBorrowLoc[0](Arg0: SDecimal)
1ImmBorrowField[1](SDecimal.is_positive: bool)
2ReadRef
3ImmBorrowLoc[0](Arg0: SDecimal)
4ImmBorrowField[0](SDecimal.value: Decimal)
5ReadRef
6Call decimal::to_rate(Decimal): Rate
7Call srate::from_rate(bool, Rate): SRate
8Ret
}
public add_with_decimal(Arg0: SDecimal, Arg1: Decimal): SDecimal {
L2: loc0: bool
L3: loc1: Decimal
L4: loc2: bool
L5: loc3: Decimal
B0:
0ImmBorrowLoc[0](Arg0: SDecimal)
1Call is_zero(&SDecimal): bool
2BrFalse(7)
B1:
3LdTrue
4MoveLoc[1](Arg1: Decimal)
5Call from_decimal(bool, Decimal): SDecimal
6Ret
B2:
7ImmBorrowLoc[0](Arg0: SDecimal)
8ImmBorrowField[1](SDecimal.is_positive: bool)
9ReadRef
10BrFalse(20)
B3:
11LdTrue
12ImmBorrowLoc[0](Arg0: SDecimal)
13ImmBorrowField[0](SDecimal.value: Decimal)
14ReadRef
15MoveLoc[1](Arg1: Decimal)
16Call decimal::add(Decimal, Decimal): Decimal
17StLoc[5](loc3: Decimal)
18StLoc[4](loc2: bool)
19Branch(46)
B4:
20ImmBorrowLoc[0](Arg0: SDecimal)
21ImmBorrowField[0](SDecimal.value: Decimal)
22ImmBorrowLoc[1](Arg1: Decimal)
23Call decimal::gt(&Decimal, &Decimal): bool
24BrFalse(34)
B5:
25LdFalse
26ImmBorrowLoc[0](Arg0: SDecimal)
27ImmBorrowField[0](SDecimal.value: Decimal)
28ReadRef
29MoveLoc[1](Arg1: Decimal)
30Call decimal::sub(Decimal, Decimal): Decimal
31StLoc[3](loc1: Decimal)
32StLoc[2](loc0: bool)
33Branch(42)
B6:
34LdTrue
35MoveLoc[1](Arg1: Decimal)
36ImmBorrowLoc[0](Arg0: SDecimal)
37ImmBorrowField[0](SDecimal.value: Decimal)
38ReadRef
39Call decimal::sub(Decimal, Decimal): Decimal
40StLoc[3](loc1: Decimal)
41StLoc[2](loc0: bool)
B7:
42MoveLoc[2](loc0: bool)
43MoveLoc[3](loc1: Decimal)
44StLoc[5](loc3: Decimal)
45StLoc[4](loc2: bool)
B8:
46MoveLoc[4](loc2: bool)
47MoveLoc[5](loc3: Decimal)
48Pack[0](SDecimal)
49Ret
}
public sub_with_decimal(Arg0: SDecimal, Arg1: Decimal): SDecimal {
L2: loc0: bool
L3: loc1: Decimal
L4: loc2: bool
L5: loc3: Decimal
B0:
0ImmBorrowLoc[0](Arg0: SDecimal)
1Call is_zero(&SDecimal): bool
2BrFalse(7)
B1:
3LdFalse
4MoveLoc[1](Arg1: Decimal)
5Call from_decimal(bool, Decimal): SDecimal
6Ret
B2:
7ImmBorrowLoc[0](Arg0: SDecimal)
8ImmBorrowField[1](SDecimal.is_positive: bool)
9ReadRef
10BrFalse(38)
B3:
11ImmBorrowLoc[0](Arg0: SDecimal)
12ImmBorrowField[0](SDecimal.value: Decimal)
13ImmBorrowLoc[1](Arg1: Decimal)
14Call decimal::gt(&Decimal, &Decimal): bool
15BrFalse(25)
B4:
16LdTrue
17ImmBorrowLoc[0](Arg0: SDecimal)
18ImmBorrowField[0](SDecimal.value: Decimal)
19ReadRef
20MoveLoc[1](Arg1: Decimal)
21Call decimal::sub(Decimal, Decimal): Decimal
22StLoc[3](loc1: Decimal)
23StLoc[2](loc0: bool)
24Branch(33)
B5:
25LdFalse
26MoveLoc[1](Arg1: Decimal)
27ImmBorrowLoc[0](Arg0: SDecimal)
28ImmBorrowField[0](SDecimal.value: Decimal)
29ReadRef
30Call decimal::sub(Decimal, Decimal): Decimal
31StLoc[3](loc1: Decimal)
32StLoc[2](loc0: bool)
B6:
33MoveLoc[2](loc0: bool)
34MoveLoc[3](loc1: Decimal)
35StLoc[5](loc3: Decimal)
36StLoc[4](loc2: bool)
37Branch(46)
B7:
38LdFalse
39ImmBorrowLoc[0](Arg0: SDecimal)
40ImmBorrowField[0](SDecimal.value: Decimal)
41ReadRef
42MoveLoc[1](Arg1: Decimal)
43Call decimal::add(Decimal, Decimal): Decimal
44StLoc[5](loc3: Decimal)
45StLoc[4](loc2: bool)
B8:
46MoveLoc[4](loc2: bool)
47MoveLoc[5](loc3: Decimal)
48Pack[0](SDecimal)
49Ret
}
public add(Arg0: SDecimal, Arg1: SDecimal): SDecimal {
L2: loc0: bool
L3: loc1: Decimal
L4: loc2: bool
L5: loc3: Decimal
B0:
0ImmBorrowLoc[0](Arg0: SDecimal)
1Call is_zero(&SDecimal): bool
2BrFalse(5)
B1:
3MoveLoc[1](Arg1: SDecimal)
4Ret
B2:
5ImmBorrowLoc[1](Arg1: SDecimal)
6Call is_zero(&SDecimal): bool
7BrFalse(10)
B3:
8MoveLoc[0](Arg0: SDecimal)
9Ret
B4:
10ImmBorrowLoc[0](Arg0: SDecimal)
11ImmBorrowField[1](SDecimal.is_positive: bool)
12ReadRef
13ImmBorrowLoc[1](Arg1: SDecimal)
14ImmBorrowField[1](SDecimal.is_positive: bool)
15ReadRef
16Eq
17BrFalse(31)
B5:
18ImmBorrowLoc[0](Arg0: SDecimal)
19ImmBorrowField[1](SDecimal.is_positive: bool)
20ReadRef
21ImmBorrowLoc[0](Arg0: SDecimal)
22ImmBorrowField[0](SDecimal.value: Decimal)
23ReadRef
24ImmBorrowLoc[1](Arg1: SDecimal)
25ImmBorrowField[0](SDecimal.value: Decimal)
26ReadRef
27Call decimal::add(Decimal, Decimal): Decimal
28StLoc[5](loc3: Decimal)
29StLoc[4](loc2: bool)
30Branch(66)
B6:
31ImmBorrowLoc[0](Arg0: SDecimal)
32ImmBorrowField[0](SDecimal.value: Decimal)
33ImmBorrowLoc[1](Arg1: SDecimal)
34ImmBorrowField[0](SDecimal.value: Decimal)
35Call decimal::gt(&Decimal, &Decimal): bool
36BrFalse(50)
B7:
37ImmBorrowLoc[0](Arg0: SDecimal)
38ImmBorrowField[1](SDecimal.is_positive: bool)
39ReadRef
40ImmBorrowLoc[0](Arg0: SDecimal)
41ImmBorrowField[0](SDecimal.value: Decimal)
42ReadRef
43ImmBorrowLoc[1](Arg1: SDecimal)
44ImmBorrowField[0](SDecimal.value: Decimal)
45ReadRef
46Call decimal::sub(Decimal, Decimal): Decimal
47StLoc[3](loc1: Decimal)
48StLoc[2](loc0: bool)
49Branch(62)
B8:
50ImmBorrowLoc[1](Arg1: SDecimal)
51ImmBorrowField[1](SDecimal.is_positive: bool)
52ReadRef
53ImmBorrowLoc[1](Arg1: SDecimal)
54ImmBorrowField[0](SDecimal.value: Decimal)
55ReadRef
56ImmBorrowLoc[0](Arg0: SDecimal)
57ImmBorrowField[0](SDecimal.value: Decimal)
58ReadRef
59Call decimal::sub(Decimal, Decimal): Decimal
60StLoc[3](loc1: Decimal)
61StLoc[2](loc0: bool)
B9:
62MoveLoc[2](loc0: bool)
63MoveLoc[3](loc1: Decimal)
64StLoc[5](loc3: Decimal)
65StLoc[4](loc2: bool)
B10:
66MoveLoc[4](loc2: bool)
67MoveLoc[5](loc3: Decimal)
68Pack[0](SDecimal)
69Ret
}
public sub(Arg0: SDecimal, Arg1: SDecimal): SDecimal {
L2: loc0: bool
L3: loc1: Decimal
L4: loc2: bool
L5: loc3: Decimal
B0:
0ImmBorrowLoc[0](Arg0: SDecimal)
1Call is_zero(&SDecimal): bool
2BrFalse(12)
B1:
3ImmBorrowLoc[1](Arg1: SDecimal)
4ImmBorrowField[1](SDecimal.is_positive: bool)
5ReadRef
6Not
7ImmBorrowLoc[1](Arg1: SDecimal)
8ImmBorrowField[0](SDecimal.value: Decimal)
9ReadRef
10Call from_decimal(bool, Decimal): SDecimal
11Ret
B2:
12ImmBorrowLoc[1](Arg1: SDecimal)
13Call is_zero(&SDecimal): bool
14BrFalse(17)
B3:
15MoveLoc[0](Arg0: SDecimal)
16Ret
B4:
17ImmBorrowLoc[0](Arg0: SDecimal)
18ImmBorrowField[1](SDecimal.is_positive: bool)
19ReadRef
20ImmBorrowLoc[1](Arg1: SDecimal)
21ImmBorrowField[1](SDecimal.is_positive: bool)
22ReadRef
23Neq
24BrFalse(38)
B5:
25ImmBorrowLoc[0](Arg0: SDecimal)
26ImmBorrowField[1](SDecimal.is_positive: bool)
27ReadRef
28ImmBorrowLoc[0](Arg0: SDecimal)
29ImmBorrowField[0](SDecimal.value: Decimal)
30ReadRef
31ImmBorrowLoc[1](Arg1: SDecimal)
32ImmBorrowField[0](SDecimal.value: Decimal)
33ReadRef
34Call decimal::add(Decimal, Decimal): Decimal
35StLoc[5](loc3: Decimal)
36StLoc[4](loc2: bool)
37Branch(74)
B6:
38ImmBorrowLoc[0](Arg0: SDecimal)
39ImmBorrowField[0](SDecimal.value: Decimal)
40ImmBorrowLoc[1](Arg1: SDecimal)
41ImmBorrowField[0](SDecimal.value: Decimal)
42Call decimal::gt(&Decimal, &Decimal): bool
43BrFalse(57)
B7:
44ImmBorrowLoc[0](Arg0: SDecimal)
45ImmBorrowField[1](SDecimal.is_positive: bool)
46ReadRef
47ImmBorrowLoc[0](Arg0: SDecimal)
48ImmBorrowField[0](SDecimal.value: Decimal)
49ReadRef
50ImmBorrowLoc[1](Arg1: SDecimal)
51ImmBorrowField[0](SDecimal.value: Decimal)
52ReadRef
53Call decimal::sub(Decimal, Decimal): Decimal
54StLoc[3](loc1: Decimal)
55StLoc[2](loc0: bool)
56Branch(70)
B8:
57ImmBorrowLoc[0](Arg0: SDecimal)
58ImmBorrowField[1](SDecimal.is_positive: bool)
59ReadRef
60Not
61ImmBorrowLoc[1](Arg1: SDecimal)
62ImmBorrowField[0](SDecimal.value: Decimal)
63ReadRef
64ImmBorrowLoc[0](Arg0: SDecimal)
65ImmBorrowField[0](SDecimal.value: Decimal)
66ReadRef
67Call decimal::sub(Decimal, Decimal): Decimal
68StLoc[3](loc1: Decimal)
69StLoc[2](loc0: bool)
B9:
70MoveLoc[2](loc0: bool)
71MoveLoc[3](loc1: Decimal)
72StLoc[5](loc3: Decimal)
73StLoc[4](loc2: bool)
B10:
74MoveLoc[4](loc2: bool)
75MoveLoc[5](loc3: Decimal)
76Pack[0](SDecimal)
77Ret
}
public mul_with_u64(Arg0: SDecimal, Arg1: u64): SDecimal {
B0:
0ImmBorrowLoc[0](Arg0: SDecimal)
1ImmBorrowField[1](SDecimal.is_positive: bool)
2ReadRef
3ImmBorrowLoc[0](Arg0: SDecimal)
4ImmBorrowField[0](SDecimal.value: Decimal)
5ReadRef
6MoveLoc[1](Arg1: u64)
7Call decimal::mul_with_u64(Decimal, u64): Decimal
8Pack[0](SDecimal)
9Ret
}
public mul_with_rate(Arg0: SDecimal, Arg1: Rate): SDecimal {
B0:
0ImmBorrowLoc[0](Arg0: SDecimal)
1ImmBorrowField[1](SDecimal.is_positive: bool)
2ReadRef
3ImmBorrowLoc[0](Arg0: SDecimal)
4ImmBorrowField[0](SDecimal.value: Decimal)
5ReadRef
6MoveLoc[1](Arg1: Rate)
7Call decimal::mul_with_rate(Decimal, Rate): Decimal
8Pack[0](SDecimal)
9Ret
}
public mul_with_decimal(Arg0: SDecimal, Arg1: Decimal): SDecimal {
B0:
0ImmBorrowLoc[0](Arg0: SDecimal)
1ImmBorrowField[1](SDecimal.is_positive: bool)
2ReadRef
3ImmBorrowLoc[0](Arg0: SDecimal)
4ImmBorrowField[0](SDecimal.value: Decimal)
5ReadRef
6MoveLoc[1](Arg1: Decimal)
7Call decimal::mul(Decimal, Decimal): Decimal
8Pack[0](SDecimal)
9Ret
}
public mul_with_srate(Arg0: SDecimal, Arg1: SRate): SDecimal {
B0:
0ImmBorrowLoc[0](Arg0: SDecimal)
1ImmBorrowField[1](SDecimal.is_positive: bool)
2ReadRef
3ImmBorrowLoc[1](Arg1: SRate)
4Call srate::is_positive(&SRate): bool
5Eq
6ImmBorrowLoc[0](Arg0: SDecimal)
7ImmBorrowField[0](SDecimal.value: Decimal)
8ReadRef
9ImmBorrowLoc[1](Arg1: SRate)
10Call srate::value(&SRate): Rate
11Call decimal::mul_with_rate(Decimal, Rate): Decimal
12Pack[0](SDecimal)
13Ret
}
public mul(Arg0: SDecimal, Arg1: SDecimal): SDecimal {
B0:
0ImmBorrowLoc[0](Arg0: SDecimal)
1ImmBorrowField[1](SDecimal.is_positive: bool)
2ReadRef
3ImmBorrowLoc[1](Arg1: SDecimal)
4ImmBorrowField[1](SDecimal.is_positive: bool)
5ReadRef
6Eq
7ImmBorrowLoc[0](Arg0: SDecimal)
8ImmBorrowField[0](SDecimal.value: Decimal)
9ReadRef
10ImmBorrowLoc[1](Arg1: SDecimal)
11ImmBorrowField[0](SDecimal.value: Decimal)
12ReadRef
13Call decimal::mul(Decimal, Decimal): Decimal
14Pack[0](SDecimal)
15Ret
}
public div_by_u64(Arg0: SDecimal, Arg1: u64): SDecimal {
B0:
0ImmBorrowLoc[0](Arg0: SDecimal)
1ImmBorrowField[1](SDecimal.is_positive: bool)
2ReadRef
3ImmBorrowLoc[0](Arg0: SDecimal)
4ImmBorrowField[0](SDecimal.value: Decimal)
5ReadRef
6MoveLoc[1](Arg1: u64)
7Call decimal::div_by_u64(Decimal, u64): Decimal
8Pack[0](SDecimal)
9Ret
}
public div_by_rate(Arg0: SDecimal, Arg1: Rate): SDecimal {
B0:
0ImmBorrowLoc[0](Arg0: SDecimal)
1ImmBorrowField[1](SDecimal.is_positive: bool)
2ReadRef
3ImmBorrowLoc[0](Arg0: SDecimal)
4ImmBorrowField[0](SDecimal.value: Decimal)
5ReadRef
6MoveLoc[1](Arg1: Rate)
7Call decimal::div_by_rate(Decimal, Rate): Decimal
8Pack[0](SDecimal)
9Ret
}
public div_by_srate(Arg0: SDecimal, Arg1: SRate): SDecimal {
B0:
0ImmBorrowLoc[0](Arg0: SDecimal)
1ImmBorrowField[1](SDecimal.is_positive: bool)
2ReadRef
3ImmBorrowLoc[1](Arg1: SRate)
4Call srate::is_positive(&SRate): bool
5Eq
6ImmBorrowLoc[0](Arg0: SDecimal)
7ImmBorrowField[0](SDecimal.value: Decimal)
8ReadRef
9ImmBorrowLoc[1](Arg1: SRate)
10Call srate::value(&SRate): Rate
11Call decimal::div_by_rate(Decimal, Rate): Decimal
12Pack[0](SDecimal)
13Ret
}
public div_by_decimal(Arg0: SDecimal, Arg1: Decimal): SDecimal {
B0:
0ImmBorrowLoc[0](Arg0: SDecimal)
1ImmBorrowField[1](SDecimal.is_positive: bool)
2ReadRef
3ImmBorrowLoc[0](Arg0: SDecimal)
4ImmBorrowField[0](SDecimal.value: Decimal)
5ReadRef
6MoveLoc[1](Arg1: Decimal)
7Call decimal::div(Decimal, Decimal): Decimal
8Pack[0](SDecimal)
9Ret
}
public div(Arg0: SDecimal, Arg1: SDecimal): SDecimal {
B0:
0ImmBorrowLoc[0](Arg0: SDecimal)
1ImmBorrowField[1](SDecimal.is_positive: bool)
2ReadRef
3ImmBorrowLoc[1](Arg1: SDecimal)
4ImmBorrowField[1](SDecimal.is_positive: bool)
5ReadRef
6Eq
7ImmBorrowLoc[0](Arg0: SDecimal)
8ImmBorrowField[0](SDecimal.value: Decimal)
9ReadRef
10ImmBorrowLoc[1](Arg1: SDecimal)
11ImmBorrowField[0](SDecimal.value: Decimal)
12ReadRef
13Call decimal::div(Decimal, Decimal): Decimal
14Pack[0](SDecimal)
15Ret
}
public pow_u64(Arg0: SDecimal, Arg1: u64): SDecimal {
L2: loc0: SDecimal
L3: loc1: u64
L4: loc2: SDecimal
B0:
0CopyLoc[1](Arg1: u64)
1LdU64(0)
2Eq
3BrFalse(6)
B1:
4Call one(): SDecimal
5Ret
B2:
6ImmBorrowLoc[0](Arg0: SDecimal)
7Call is_zero(&SDecimal): bool
8BrFalse(11)
B3:
9Call zero(): SDecimal
10Ret
B4:
11Call one(): SDecimal
12StLoc[4](loc2: SDecimal)
13MoveLoc[0](Arg0: SDecimal)
14StLoc[2](loc0: SDecimal)
15MoveLoc[1](Arg1: u64)
16StLoc[3](loc1: u64)
B5:
17CopyLoc[3](loc1: u64)
18LdU64(0)
19Gt
20BrFalse(45)
B6:
21CopyLoc[3](loc1: u64)
22LdU64(2)
23Mod
24LdU64(1)
25Eq
26BrFalse(32)
B7:
27MoveLoc[4](loc2: SDecimal)
28CopyLoc[2](loc0: SDecimal)
29Call mul(SDecimal, SDecimal): SDecimal
30StLoc[4](loc2: SDecimal)
31Branch(32)
B8:
32MoveLoc[3](loc1: u64)
33LdU64(2)
34Div
35StLoc[3](loc1: u64)
36CopyLoc[3](loc1: u64)
37LdU64(0)
38Gt
39BrFalse(17)
B9:
40CopyLoc[2](loc0: SDecimal)
41MoveLoc[2](loc0: SDecimal)
42Call mul(SDecimal, SDecimal): SDecimal
43StLoc[2](loc0: SDecimal)
44Branch(17)
B10:
45MoveLoc[4](loc2: SDecimal)
46Ret
}
}