Skip to content

Commit d5db4d2

Browse files
committed
fix(json-abi): add regression test and adjust abi-to-sol formatting
1 parent 6586c7f commit d5db4d2

File tree

12 files changed

+74
-8
lines changed

12 files changed

+74
-8
lines changed

crates/json-abi/src/to_sol.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,12 @@ impl JsonAbi {
229229

230230
out.push('}');
231231
out.indent_level -= 1;
232+
232233
if !its.globals.is_empty() {
233234
out.push('\n');
234235
fmt!(its.globals);
235236
out.pop(); // trailing newline
237+
out.pop(); // trailing newline
236238
}
237239
}
238240
}

crates/json-abi/tests/abi/BlurExchange.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,4 @@ struct Order {
9494
Fee[] fees;
9595
uint256 salt;
9696
bytes extraParams;
97-
}
97+
}

crates/json-abi/tests/abi/Bootstrap.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ type CallType is bytes1;
3333
struct BootstrapConfig {
3434
address module;
3535
bytes data;
36-
}
36+
}

crates/json-abi/tests/abi/ContractUsingGlobals.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ type GlobalUDT is uint256;
1818
struct GlobalStruct {
1919
uint256 value;
2020
GlobalEnum enum_;
21-
}
21+
}

crates/json-abi/tests/abi/DelegationManager.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,4 +127,4 @@ interface DelegationManager {
127127
function unpause(uint256 newPausedStatus) external;
128128
function updateOperatorMetadataURI(string memory metadataURI) external;
129129
}
130-
type DelegatedShares is uint256;
130+
type DelegatedShares is uint256;

crates/json-abi/tests/abi/Fastlane.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,4 @@ struct ValidatorBalanceCheckpoint {
9393
struct ValidatorPreferences {
9494
uint256 minAutoshipAmount;
9595
address validatorPayableAddress;
96-
}
96+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[
2+
{
3+
"type": "function",
4+
"name": "handle",
5+
"inputs": [
6+
{
7+
"name": "foobar",
8+
"type": "tuple",
9+
"internalType": "struct IHandler.FooBar",
10+
"components": [
11+
{
12+
"name": "foo",
13+
"type": "tuple",
14+
"internalType": "struct Foo",
15+
"components": [
16+
{
17+
"name": "newNumber",
18+
"type": "uint256",
19+
"internalType": "uint256"
20+
}
21+
]
22+
}
23+
]
24+
}
25+
],
26+
"outputs": [],
27+
"stateMutability": "nonpayable"
28+
}
29+
]
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
library IHandler {
2+
struct FooBar {
3+
Foo foo;
4+
}
5+
}
6+
7+
interface Handler {
8+
function handle(IHandler.FooBar memory foobar) external;
9+
}
10+
struct Foo {
11+
uint256 newNumber;
12+
}

crates/json-abi/tests/abi/Seaport.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,4 @@ struct SpentItem {
183183
address token;
184184
uint256 identifier;
185185
uint256 amount;
186-
}
186+
}

crates/json-abi/tests/abi/UniswapV3Position.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ struct Range {
77
int24 lowerTick;
88
int24 upperTick;
99
uint24 feeTier;
10-
}
10+
}

0 commit comments

Comments
 (0)