fix: Push3 optimizer: dyadic rational input interface (8 slots) + 4-output redesign (#548)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
c3792b2a63
commit
5d204e5649
5 changed files with 409 additions and 229 deletions
|
|
@ -31,25 +31,13 @@ contract OptimizerV3Push3 {
|
|||
require(inputs[k].shift == 0, "shift not yet supported");
|
||||
}
|
||||
|
||||
// Decode dyadic rational inputs (mantissa * 2^(-shift); shift=0 for current inputs)
|
||||
uint256 _d0 = uint256(inputs[0].mantissa);
|
||||
uint256 _d1 = uint256(inputs[1].mantissa);
|
||||
/* _d2 = uint256(inputs[2].mantissa); */
|
||||
// Available but not used in current implementation
|
||||
/* _d3 = uint256(inputs[3].mantissa); */
|
||||
// Available but not used in current implementation
|
||||
/* _d4 = uint256(inputs[4].mantissa); */
|
||||
// Available but not used in current implementation
|
||||
/* _d5 = uint256(inputs[5].mantissa); */
|
||||
// Available but not used in current implementation
|
||||
/* _d6 = uint256(inputs[6].mantissa); */
|
||||
// Available but not used in current implementation
|
||||
/* _d7 = uint256(inputs[7].mantissa); */
|
||||
// Available but not used in current implementation
|
||||
uint256 rawpct = uint256(_d0);
|
||||
uint256 taxrate = uint256(_d1);
|
||||
uint256 staked = uint256(((rawpct * 100) / 1000000000000000000));
|
||||
bool b33;
|
||||
uint256 percentagestaked = uint256(uint256(inputs[0].mantissa));
|
||||
uint256 taxrate = uint256(uint256(inputs[1].mantissa));
|
||||
uint256 staked = uint256(((percentagestaked * 100) / 1000000000000000000));
|
||||
uint256 r37;
|
||||
uint256 r38;
|
||||
uint256 r39;
|
||||
uint256 r40;
|
||||
if ((staked > 91)) {
|
||||
uint256 deltas = uint256((100 - staked));
|
||||
uint256 r28;
|
||||
|
|
@ -125,172 +113,60 @@ contract OptimizerV3Push3 {
|
|||
r11 = uint256(17);
|
||||
} else {
|
||||
uint256 r10;
|
||||
if ((taxrate <= 63917525773195876))
|
||||
{
|
||||
if ((taxrate <= 63917525773195876)) {
|
||||
r10 = uint256(18);
|
||||
} else {
|
||||
uint256 r9;
|
||||
if (
|
||||
(
|
||||
taxrate
|
||||
<= 83505154639175257
|
||||
)
|
||||
) {
|
||||
if ((taxrate <= 83505154639175257)) {
|
||||
r9 = uint256(19);
|
||||
} else {
|
||||
uint256 r8;
|
||||
if (
|
||||
(
|
||||
taxrate
|
||||
<=
|
||||
109278350515463917
|
||||
)
|
||||
) {
|
||||
if ((taxrate <= 109278350515463917)) {
|
||||
r8 = uint256(20);
|
||||
} else {
|
||||
uint256 r7;
|
||||
if (
|
||||
(
|
||||
taxrate
|
||||
<=
|
||||
144329896907216494
|
||||
)
|
||||
) {
|
||||
if ((taxrate <= 144329896907216494)) {
|
||||
r7 = uint256(21);
|
||||
} else {
|
||||
uint256 r6;
|
||||
if (
|
||||
(
|
||||
taxrate
|
||||
<=
|
||||
185567010309278350
|
||||
)
|
||||
) {
|
||||
if ((taxrate <= 185567010309278350)) {
|
||||
r6 = uint256(22);
|
||||
} else {
|
||||
uint256 r5;
|
||||
if (
|
||||
(
|
||||
taxrate
|
||||
<=
|
||||
237113402061855670
|
||||
)
|
||||
) {
|
||||
r5 = uint256(
|
||||
23
|
||||
);
|
||||
if ((taxrate <= 237113402061855670)) {
|
||||
r5 = uint256(23);
|
||||
} else {
|
||||
uint256 r4;
|
||||
if (
|
||||
(
|
||||
taxrate
|
||||
<=
|
||||
309278350515463917
|
||||
)
|
||||
) {
|
||||
r4 =
|
||||
uint256(
|
||||
24
|
||||
);
|
||||
if ((taxrate <= 309278350515463917)) {
|
||||
r4 = uint256(24);
|
||||
} else {
|
||||
uint256
|
||||
r3;
|
||||
if (
|
||||
(
|
||||
taxrate
|
||||
<=
|
||||
402061855670103092
|
||||
)
|
||||
) {
|
||||
r3 =
|
||||
uint256(
|
||||
25
|
||||
);
|
||||
uint256 r3;
|
||||
if ((taxrate <= 402061855670103092)) {
|
||||
r3 = uint256(25);
|
||||
} else {
|
||||
uint256
|
||||
r2;
|
||||
if (
|
||||
(
|
||||
taxrate
|
||||
<=
|
||||
520618556701030927
|
||||
)
|
||||
) {
|
||||
r2
|
||||
=
|
||||
uint256(
|
||||
26
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint256
|
||||
r1;
|
||||
if (
|
||||
(
|
||||
taxrate
|
||||
<=
|
||||
680412371134020618
|
||||
)
|
||||
)
|
||||
{
|
||||
r1
|
||||
=
|
||||
uint256(
|
||||
27
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint256
|
||||
r0;
|
||||
if (
|
||||
(
|
||||
taxrate
|
||||
<=
|
||||
886597938144329896
|
||||
)
|
||||
)
|
||||
{
|
||||
r0
|
||||
=
|
||||
uint256(
|
||||
28
|
||||
);
|
||||
uint256 r2;
|
||||
if ((taxrate <= 520618556701030927)) {
|
||||
r2 = uint256(26);
|
||||
} else {
|
||||
uint256 r1;
|
||||
if ((taxrate <= 680412371134020618)) {
|
||||
r1 = uint256(27);
|
||||
} else {
|
||||
uint256 r0;
|
||||
if ((taxrate <= 886597938144329896)) {
|
||||
r0 = uint256(28);
|
||||
} else {
|
||||
r0 = uint256(29);
|
||||
}
|
||||
else
|
||||
{
|
||||
r0
|
||||
=
|
||||
uint256(
|
||||
29
|
||||
);
|
||||
}
|
||||
r1
|
||||
=
|
||||
uint256(
|
||||
r0
|
||||
);
|
||||
r1 = uint256(r0);
|
||||
}
|
||||
r2
|
||||
=
|
||||
uint256(
|
||||
r1
|
||||
);
|
||||
r2 = uint256(r1);
|
||||
}
|
||||
r3 =
|
||||
uint256(
|
||||
r2
|
||||
);
|
||||
r3 = uint256(r2);
|
||||
}
|
||||
r4 =
|
||||
uint256(
|
||||
r3
|
||||
);
|
||||
r4 = uint256(r3);
|
||||
}
|
||||
r5 = uint256(
|
||||
r4
|
||||
);
|
||||
r5 = uint256(r4);
|
||||
}
|
||||
r6 = uint256(r5);
|
||||
}
|
||||
|
|
@ -353,28 +229,34 @@ contract OptimizerV3Push3 {
|
|||
r32 = uint256(dup29);
|
||||
}
|
||||
uint256 effidx = uint256(r32);
|
||||
b33 = (((((deltas * deltas) * deltas) * effidx) / 20) < 50);
|
||||
uint256 r33;
|
||||
uint256 r34;
|
||||
uint256 r35;
|
||||
uint256 r36;
|
||||
if ((((((deltas * deltas) * deltas) * effidx) / 20) < 50)) {
|
||||
r33 = uint256(1000000000000000000);
|
||||
r34 = uint256(20);
|
||||
r35 = uint256(1000000000000000000);
|
||||
r36 = uint256(0);
|
||||
} else {
|
||||
r33 = uint256(300000000000000000);
|
||||
r34 = uint256(100);
|
||||
r35 = uint256(300000000000000000);
|
||||
r36 = uint256(0);
|
||||
}
|
||||
r37 = uint256(r33);
|
||||
r38 = uint256(r34);
|
||||
r39 = uint256(r35);
|
||||
r40 = uint256(r36);
|
||||
} else {
|
||||
b33 = false;
|
||||
r37 = uint256(300000000000000000);
|
||||
r38 = uint256(100);
|
||||
r39 = uint256(300000000000000000);
|
||||
r40 = uint256(0);
|
||||
}
|
||||
uint256 r34;
|
||||
uint256 r35;
|
||||
uint256 r36;
|
||||
uint256 r37;
|
||||
if (b33) {
|
||||
r34 = uint256(1000000000000000000);
|
||||
r35 = uint256(20);
|
||||
r36 = uint256(1000000000000000000);
|
||||
r37 = uint256(0);
|
||||
} else {
|
||||
r34 = uint256(300000000000000000);
|
||||
r35 = uint256(100);
|
||||
r36 = uint256(300000000000000000);
|
||||
r37 = uint256(0);
|
||||
}
|
||||
ci = uint256(r37);
|
||||
anchorShare = uint256(r36);
|
||||
anchorWidth = uint24(r35);
|
||||
discoveryDepth = uint256(r34);
|
||||
ci = uint256(r40);
|
||||
anchorShare = uint256(r39);
|
||||
anchorWidth = uint24(r38);
|
||||
discoveryDepth = uint256(r37);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue