Skip to content

Commit 7e623a3

Browse files
committed
wip
1 parent 7f9826c commit 7e623a3

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

deploy-scenario.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ SCENARIO=$1
66
RPC=${RPC_URL:-http://127.0.0.1:8545}
77

88
rm -rf dev-ctx/
9-
mkdir -p dev-ctx/{addresses,labels,priceapi}/31337
9+
mkdir -p dev-ctx/{addresses,labels,priceapi,tokenlist}/31337
1010

1111
forge script --rpc-url "$RPC_URL" "script/scenarios/$SCENARIO.s.sol" --broadcast --code-size-limit 100000 -vv
1212
cast rpc --rpc-url "$RPC_URL" evm_increaseTime 86400 || true

script/DeployScenario.s.sol

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import {SequenceRegistry} from "evk/SequenceRegistry/SequenceRegistry.sol";
3939

4040
struct Asset {
4141
string symbol;
42+
uint8 decimals;
4243
address asset;
4344
address vault;
4445
string price;
@@ -174,6 +175,7 @@ contract DeployScenario is Script {
174175
Asset memory a;
175176

176177
a.symbol = symbol;
178+
a.decimals = decimals;
177179
a.asset = address(new TestERC20(string(abi.encodePacked(symbol, " Token")), symbol, decimals, false));
178180
a.vault = factory.createProxy(address(0), true, abi.encodePacked(a.asset, address(oracle), unitOfAccount));
179181
a.price = price;
@@ -243,6 +245,37 @@ contract DeployScenario is Script {
243245

244246
vm.writeLine(pricesFile, "}");
245247
}
248+
249+
{
250+
string memory tokenListFile = "./dev-ctx/tokenlist/31337/tokenList.json";
251+
vm.writeLine(tokenListFile, "[");
252+
253+
for (uint256 i; i < assets.length; ++i) {
254+
vm.writeLine(tokenListFile, " {");
255+
256+
vm.writeLine(tokenListFile, " \"chainId\": 31337,");
257+
vm.writeLine(tokenListFile, string(abi.encodePacked(" \"address\": \"", vm.toString(assets[i].asset), "\",")));
258+
vm.writeLine(tokenListFile, string(abi.encodePacked(" \"symbol\": \"", assets[i].symbol, "\",")));
259+
vm.writeLine(tokenListFile, string(abi.encodePacked(" \"decimals\": ", vm.toString(assets[i].decimals))));
260+
261+
vm.writeLine(tokenListFile, string(abi.encodePacked(" }", (i == assets.length - 1 ? "" : ","))));
262+
/*
263+
string memory line = string(
264+
abi.encodePacked(
265+
"\"",
266+
vm.toString(assets[i].asset),
267+
"\": {\"price\":",
268+
assets[i].price,
269+
"}",
270+
(i == assets.length - 1 ? "" : ",")
271+
)
272+
);
273+
vm.writeLine(pricesFile, line);
274+
*/
275+
}
276+
277+
vm.writeLine(tokenListFile, "]");
278+
}
246279
}
247280

248281
function getSubaccount(address user, uint8 account) internal pure returns (address) {

0 commit comments

Comments
 (0)