Skip to content

Commit

Permalink
Feat/gas optimizations (#3)
Browse files Browse the repository at this point in the history
iteration optimizations
  • Loading branch information
killroy192 authored Jul 24, 2024
1 parent 63110e8 commit ba5bc39
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"ignoreConstructors": true
}
],
"max-line-length": ["error", 100],
"max-line-length": ["error", 101],
"not-rely-on-time": "off",
"reason-string": [
"warn",
Expand Down
16 changes: 4 additions & 12 deletions deployment-lock.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"mainnet": {
"Miller": {
"address": "0x203FD1a00Fa2d80EeAd9A8d982b3B47ec3BE2427",
"address": "0x5eB167E672f59beef587b55aA5716e2dd6C0Bc96",
"abi": [
{
"type": "error",
Expand Down Expand Up @@ -31,16 +31,8 @@
],
"name": "AddressInsufficientBalance"
},
{
"type": "error",
"inputs": [],
"name": "FailedInnerCall"
},
{
"type": "error",
"inputs": [],
"name": "RecipientRevert"
},
{ "type": "error", "inputs": [], "name": "FailedInnerCall" },
{ "type": "error", "inputs": [], "name": "RecipientRevert" },
{
"type": "error",
"inputs": [
Expand Down Expand Up @@ -322,7 +314,7 @@
"gas": null
}
],
"factoryByteCode": "0x608060405234801561001057600080fd5b5061101a806100206000396000f3fe60806040526004361061003f5760003560e01c80635c13bf3d146100445780639844b57514610060578063beed63e314610089578063f774c758146100b2575b600080fd5b61005e60048036038101906100599190610890565b6100ce565b005b34801561006c57600080fd5b5061008760048036038101906100829190610a8c565b610190565b005b34801561009557600080fd5b506100b060048036038101906100ab9190610b62565b61023b565b005b6100cc60048036038101906100c79190610c24565b610312565b005b60005b8282905081101561014d5761013a8383838181106100f2576100f1610c84565b5b905060400201602001602081019061010a9190610cb3565b84848481811061011d5761011c610c84565b5b90506040020160000160208101906101359190610ce0565b6103a8565b808061014590610d3c565b9150506100d1565b507f2ab0d312ec5eef312bf327c57a266c37191bf9c85aeea6c7d67c3a2db9f05bb7610177610470565b6040516101849190610d93565b60405180910390a15050565b61019e868686868686610478565b60005b888890508110156101f1576101de8989838181106101c2576101c1610c84565b5b90506020020160208101906101d79190610cb3565b888c6104f8565b80806101e990610d3c565b9150506101a1565b507f2ab0d312ec5eef312bf327c57a266c37191bf9c85aeea6c7d67c3a2db9f05bb761021b610470565b6040516102289190610d93565b60405180910390a1505050505050505050565b610249868686868686610478565b60005b888890508110156102c9576102b689898381811061026d5761026c610c84565b5b90506040020160200160208101906102859190610cb3565b888b8b8581811061029957610298610c84565b5b90506040020160000160208101906102b19190610ce0565b6104f8565b80806102c190610d3c565b91505061024c565b507f2ab0d312ec5eef312bf327c57a266c37191bf9c85aeea6c7d67c3a2db9f05bb76102f3610470565b6040516103009190610d93565b60405180910390a15050505050505050565b60005b828290508110156103645761035183838381811061033657610335610c84565b5b905060200201602081019061034b9190610cb3565b856103a8565b808061035c90610d3c565b915050610315565b507f2ab0d312ec5eef312bf327c57a266c37191bf9c85aeea6c7d67c3a2db9f05bb761038e610470565b60405161039b9190610d93565b60405180910390a1505050565b60008273ffffffffffffffffffffffffffffffffffffffff16827dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff166040516103ee90610ddf565b60006040518083038185875af1925050503d806000811461042b576040519150601f19603f3d011682016040523d82523d6000602084013e610430565b606091505b505090508061046b576040517fbdbccb1200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050565b600033905090565b8573ffffffffffffffffffffffffffffffffffffffff1663d505accf61049c610470565b3088888888886040518863ffffffff1660e01b81526004016104c49796959493929190610e5c565b600060405180830381600087803b1580156104de57600080fd5b505af19250505080156104ef575060015b50505050505050565b61054c610503610470565b84837dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16610551909392919063ffffffff16565b505050565b6105cd848573ffffffffffffffffffffffffffffffffffffffff166323b872dd86868660405160240161058693929190610ecb565b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506105d3565b50505050565b60006105fe828473ffffffffffffffffffffffffffffffffffffffff1661066a90919063ffffffff16565b905060008151141580156106235750808060200190518101906106219190610f3a565b155b1561066557826040517f5274afe700000000000000000000000000000000000000000000000000000000815260040161065c9190610d93565b60405180910390fd5b505050565b606061067883836000610680565b905092915050565b6060814710156106c757306040517fcd7860590000000000000000000000000000000000000000000000000000000081526004016106be9190610d93565b60405180910390fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1684866040516106f09190610fcd565b60006040518083038185875af1925050503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b509150915061074286838361074d565b925050509392505050565b6060826107625761075d826107dc565b6107d4565b6000825114801561078a575060008473ffffffffffffffffffffffffffffffffffffffff163b145b156107cc57836040517f9996b3150000000000000000000000000000000000000000000000000000000081526004016107c39190610d93565b60405180910390fd5b8190506107d5565b5b9392505050565b6000815111156107ef5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f8401126108505761084f61082b565b5b8235905067ffffffffffffffff81111561086d5761086c610830565b5b60208301915083604082028301111561088957610888610835565b5b9250929050565b600080602083850312156108a7576108a6610821565b5b600083013567ffffffffffffffff8111156108c5576108c4610826565b5b6108d18582860161083a565b92509250509250929050565b60007dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82169050919050565b610910816108dd565b811461091b57600080fd5b50565b60008135905061092d81610907565b92915050565b60008083601f8401126109495761094861082b565b5b8235905067ffffffffffffffff81111561096657610965610830565b5b60208301915083602082028301111561098257610981610835565b5b9250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006109b482610989565b9050919050565b6109c4816109a9565b81146109cf57600080fd5b50565b6000813590506109e1816109bb565b92915050565b6000819050919050565b6109fa816109e7565b8114610a0557600080fd5b50565b600081359050610a17816109f1565b92915050565b600060ff82169050919050565b610a3381610a1d565b8114610a3e57600080fd5b50565b600081359050610a5081610a2a565b92915050565b6000819050919050565b610a6981610a56565b8114610a7457600080fd5b50565b600081359050610a8681610a60565b92915050565b60008060008060008060008060006101008a8c031215610aaf57610aae610821565b5b6000610abd8c828d0161091e565b99505060208a013567ffffffffffffffff811115610ade57610add610826565b5b610aea8c828d01610933565b98509850506040610afd8c828d016109d2565b9650506060610b0e8c828d0161091e565b9550506080610b1f8c828d01610a08565b94505060a0610b308c828d01610a41565b93505060c0610b418c828d01610a77565b92505060e0610b528c828d01610a77565b9150509295985092959850929598565b60008060008060008060008060e0898b031215610b8257610b81610821565b5b600089013567ffffffffffffffff811115610ba057610b9f610826565b5b610bac8b828c0161083a565b98509850506020610bbf8b828c016109d2565b9650506040610bd08b828c0161091e565b9550506060610be18b828c01610a08565b9450506080610bf28b828c01610a41565b93505060a0610c038b828c01610a77565b92505060c0610c148b828c01610a77565b9150509295985092959890939650565b600080600060408486031215610c3d57610c3c610821565b5b6000610c4b8682870161091e565b935050602084013567ffffffffffffffff811115610c6c57610c6b610826565b5b610c7886828701610933565b92509250509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215610cc957610cc8610821565b5b6000610cd7848285016109d2565b91505092915050565b600060208284031215610cf657610cf5610821565b5b6000610d048482850161091e565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610d47826109e7565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610d7957610d78610d0d565b5b600182019050919050565b610d8d816109a9565b82525050565b6000602082019050610da86000830184610d84565b92915050565b600081905092915050565b50565b6000610dc9600083610dae565b9150610dd482610db9565b600082019050919050565b6000610dea82610dbc565b9150819050919050565b6000819050919050565b6000610e19610e14610e0f846108dd565b610df4565b6109e7565b9050919050565b610e2981610dfe565b82525050565b610e38816109e7565b82525050565b610e4781610a1d565b82525050565b610e5681610a56565b82525050565b600060e082019050610e71600083018a610d84565b610e7e6020830189610d84565b610e8b6040830188610e20565b610e986060830187610e2f565b610ea56080830186610e3e565b610eb260a0830185610e4d565b610ebf60c0830184610e4d565b98975050505050505050565b6000606082019050610ee06000830186610d84565b610eed6020830185610d84565b610efa6040830184610e2f565b949350505050565b60008115159050919050565b610f1781610f02565b8114610f2257600080fd5b50565b600081519050610f3481610f0e565b92915050565b600060208284031215610f5057610f4f610821565b5b6000610f5e84828501610f25565b91505092915050565b600081519050919050565b60005b83811015610f90578082015181840152602081019050610f75565b60008484015250505050565b6000610fa782610f67565b610fb18185610dae565b9350610fc1818560208601610f72565b80840191505092915050565b6000610fd98284610f9c565b91508190509291505056fea26469706673582212200e552517696528e60686d8272705359b166585505f4063f6fa1ed805955d824c64736f6c63430008140033",
"factoryByteCode": "0x608060405234801561001057600080fd5b50610f69806100206000396000f3fe60806040526004361061003f5760003560e01c80635c13bf3d146100445780639844b57514610060578063beed63e314610089578063f774c758146100b2575b600080fd5b61005e60048036038101906100599190610856565b6100ce565b005b34801561006c57600080fd5b5061008760048036038101906100829190610a52565b610187565b005b34801561009557600080fd5b506100b060048036038101906100ab9190610b28565b610229565b005b6100cc60048036038101906100c79190610bea565b6102f7565b005b600082829050905060005b8181101561014a5761013f8484838181106100f7576100f6610c4a565b5b905060400201602001602081019061010f9190610c79565b85858481811061012257610121610c4a565b5b905060400201600001602081019061013a9190610ca6565b610384565b8060010190506100d9565b507f2ab0d312ec5eef312bf327c57a266c37191bf9c85aeea6c7d67c3a2db9f05bb73360405161017a9190610ce2565b60405180910390a1505050565b61019586868686868661044c565b600088889050905060005b818110156101e5576101da8a8a838181106101be576101bd610c4a565b5b90506020020160208101906101d39190610c79565b898d6104c5565b8060010190506101a0565b507f2ab0d312ec5eef312bf327c57a266c37191bf9c85aeea6c7d67c3a2db9f05bb7336040516102159190610ce2565b60405180910390a150505050505050505050565b61023786868686868661044c565b600088889050905060005b818110156102b4576102a98a8a838181106102605761025f610c4a565b5b90506040020160200160208101906102789190610c79565b898c8c8581811061028c5761028b610c4a565b5b90506040020160000160208101906102a49190610ca6565b6104c5565b806001019050610242565b507f2ab0d312ec5eef312bf327c57a266c37191bf9c85aeea6c7d67c3a2db9f05bb7336040516102e49190610ce2565b60405180910390a1505050505050505050565b600082829050905060005b818110156103465761033b8484838181106103205761031f610c4a565b5b90506020020160208101906103359190610c79565b86610384565b806001019050610302565b507f2ab0d312ec5eef312bf327c57a266c37191bf9c85aeea6c7d67c3a2db9f05bb7336040516103769190610ce2565b60405180910390a150505050565b60008273ffffffffffffffffffffffffffffffffffffffff16827dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff166040516103ca90610d2e565b60006040518083038185875af1925050503d8060008114610407576040519150601f19603f3d011682016040523d82523d6000602084013e61040c565b606091505b5050905080610447576040517fbdbccb1200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050565b8573ffffffffffffffffffffffffffffffffffffffff1663d505accf333088888888886040518863ffffffff1660e01b81526004016104919796959493929190610dab565b600060405180830381600087803b1580156104ab57600080fd5b505af19250505080156104bc575060015b50505050505050565b6105123384837dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16610517909392919063ffffffff16565b505050565b610593848573ffffffffffffffffffffffffffffffffffffffff166323b872dd86868660405160240161054c93929190610e1a565b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050610599565b50505050565b60006105c4828473ffffffffffffffffffffffffffffffffffffffff1661063090919063ffffffff16565b905060008151141580156105e95750808060200190518101906105e79190610e89565b155b1561062b57826040517f5274afe70000000000000000000000000000000000000000000000000000000081526004016106229190610ce2565b60405180910390fd5b505050565b606061063e83836000610646565b905092915050565b60608147101561068d57306040517fcd7860590000000000000000000000000000000000000000000000000000000081526004016106849190610ce2565b60405180910390fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1684866040516106b69190610f1c565b60006040518083038185875af1925050503d80600081146106f3576040519150601f19603f3d011682016040523d82523d6000602084013e6106f8565b606091505b5091509150610708868383610713565b925050509392505050565b60608261072857610723826107a2565b61079a565b60008251148015610750575060008473ffffffffffffffffffffffffffffffffffffffff163b145b1561079257836040517f9996b3150000000000000000000000000000000000000000000000000000000081526004016107899190610ce2565b60405180910390fd5b81905061079b565b5b9392505050565b6000815111156107b55780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610816576108156107f1565b5b8235905067ffffffffffffffff811115610833576108326107f6565b5b60208301915083604082028301111561084f5761084e6107fb565b5b9250929050565b6000806020838503121561086d5761086c6107e7565b5b600083013567ffffffffffffffff81111561088b5761088a6107ec565b5b61089785828601610800565b92509250509250929050565b60007dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82169050919050565b6108d6816108a3565b81146108e157600080fd5b50565b6000813590506108f3816108cd565b92915050565b60008083601f84011261090f5761090e6107f1565b5b8235905067ffffffffffffffff81111561092c5761092b6107f6565b5b602083019150836020820283011115610948576109476107fb565b5b9250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061097a8261094f565b9050919050565b61098a8161096f565b811461099557600080fd5b50565b6000813590506109a781610981565b92915050565b6000819050919050565b6109c0816109ad565b81146109cb57600080fd5b50565b6000813590506109dd816109b7565b92915050565b600060ff82169050919050565b6109f9816109e3565b8114610a0457600080fd5b50565b600081359050610a16816109f0565b92915050565b6000819050919050565b610a2f81610a1c565b8114610a3a57600080fd5b50565b600081359050610a4c81610a26565b92915050565b60008060008060008060008060006101008a8c031215610a7557610a746107e7565b5b6000610a838c828d016108e4565b99505060208a013567ffffffffffffffff811115610aa457610aa36107ec565b5b610ab08c828d016108f9565b98509850506040610ac38c828d01610998565b9650506060610ad48c828d016108e4565b9550506080610ae58c828d016109ce565b94505060a0610af68c828d01610a07565b93505060c0610b078c828d01610a3d565b92505060e0610b188c828d01610a3d565b9150509295985092959850929598565b60008060008060008060008060e0898b031215610b4857610b476107e7565b5b600089013567ffffffffffffffff811115610b6657610b656107ec565b5b610b728b828c01610800565b98509850506020610b858b828c01610998565b9650506040610b968b828c016108e4565b9550506060610ba78b828c016109ce565b9450506080610bb88b828c01610a07565b93505060a0610bc98b828c01610a3d565b92505060c0610bda8b828c01610a3d565b9150509295985092959890939650565b600080600060408486031215610c0357610c026107e7565b5b6000610c11868287016108e4565b935050602084013567ffffffffffffffff811115610c3257610c316107ec565b5b610c3e868287016108f9565b92509250509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215610c8f57610c8e6107e7565b5b6000610c9d84828501610998565b91505092915050565b600060208284031215610cbc57610cbb6107e7565b5b6000610cca848285016108e4565b91505092915050565b610cdc8161096f565b82525050565b6000602082019050610cf76000830184610cd3565b92915050565b600081905092915050565b50565b6000610d18600083610cfd565b9150610d2382610d08565b600082019050919050565b6000610d3982610d0b565b9150819050919050565b6000819050919050565b6000610d68610d63610d5e846108a3565b610d43565b6109ad565b9050919050565b610d7881610d4d565b82525050565b610d87816109ad565b82525050565b610d96816109e3565b82525050565b610da581610a1c565b82525050565b600060e082019050610dc0600083018a610cd3565b610dcd6020830189610cd3565b610dda6040830188610d6f565b610de76060830187610d7e565b610df46080830186610d8d565b610e0160a0830185610d9c565b610e0e60c0830184610d9c565b98975050505050505050565b6000606082019050610e2f6000830186610cd3565b610e3c6020830185610cd3565b610e496040830184610d7e565b949350505050565b60008115159050919050565b610e6681610e51565b8114610e7157600080fd5b50565b600081519050610e8381610e5d565b92915050565b600060208284031215610e9f57610e9e6107e7565b5b6000610ead84828501610e74565b91505092915050565b600081519050919050565b60005b83811015610edf578082015181840152602081019050610ec4565b60008484015250505050565b6000610ef682610eb6565b610f008185610cfd565b9350610f10818560208601610ec1565b80840191505092915050565b6000610f288284610eeb565b91508190509291505056fea26469706673582212203766c7b24704e283f7b9e6b05ae86c0d5a6b51b5ecbbd85ae2284a0bdd9caa4464736f6c63430008140033",
"args": [],
"contractName": "Miller"
}
Expand Down
5 changes: 4 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ remappings = [

[fmt]
bracket_spacing = false
line_length = 100
line_length = 101
tab_width = 4
wrap_comments = true

[fuzz]
runs = 128

# Remappings in remappings.txt

# See more config options https://github.com/gakonst/foundry/tree/master/config
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "miller",
"version": "0.0.1",
"version": "0.0.2",
"description": "Simple stateless contract to distribute tokens to multiple accounts",
"author": "Dzmitry Lahunouski",
"license": "MIT",
Expand Down
Loading

0 comments on commit ba5bc39

Please sign in to comment.