Skip to content

Commit

Permalink
Refactor: replace dapp-tools with foundry for spell flattening (#391)
Browse files Browse the repository at this point in the history
  • Loading branch information
SidestreamColdMelon committed May 21, 2024
1 parent ffc8235 commit 7d51a28
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ estimate :; ./scripts/estimate-deploy-gas.sh
deploy :; ./scripts/deploy.sh
deploy-info :; ./scripts/get-deploy-info.sh tx=$(tx)
verify :; ./scripts/verify.py DssSpell $(addr)
flatten :; hevm flatten --source-file "src/DssSpell.sol" > out/flat.sol
flatten :; forge flatten src/DssSpell.sol --output out/flat.sol
diff-deployed-spell :; ./scripts/diff-deployed-dssspell.sh $(spell)
check-deployed-spell :; ./scripts/check-deployed-dssspell.sh
cast-on-tenderly :; cd ./scripts/cast-on-tenderly/ && npm i && npm start -- $(spell); cd -
Expand Down
19 changes: 11 additions & 8 deletions scripts/verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
exit('contract name not found.')

print('Obtaining chain... ')
seth_chain = subprocess.run(['seth', 'chain'], capture_output=True)
chain = seth_chain.stdout.decode('ascii').replace('\n', '')
cast_chain = subprocess.run(['cast', 'chain'], capture_output=True)
chain = cast_chain.stdout.decode('ascii').replace('\n', '')
print(chain)

text_metadata = content['contracts'][contract_path][contract_name]['metadata']
Expand All @@ -74,13 +74,16 @@
action = 'verifysourcecode'
code_format = 'solidity-single-file'

flatten = subprocess.run([
'hevm',
flatten_output_path = 'out/flat.sol'
subprocess.run([
'forge',
'flatten',
'--source-file',
contract_path
], capture_output=True)
code = flatten.stdout.decode('utf-8')
contract_path,
'--output',
flatten_output_path
])
with open(flatten_output_path, 'r', encoding='utf-8') as code_file:
code = code_file.read()

def get_block(signature, code, with_frame=False):
block_and_tail = code[code.find(signature) :]
Expand Down

0 comments on commit 7d51a28

Please sign in to comment.