diff --git a/.gas-snapshot b/.gas-snapshot index ec83165..91757f6 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -1,5 +1,5 @@ DagonTest:testBurn(address,uint96) (runs: 256, μ: 153049, ~: 153049) -DagonTest:testDeploy() (gas: 2234574) +DagonTest:testDeploy() (gas: 2232167) DagonTest:testFailBurnOverBalance(address,uint96) (runs: 256, μ: 187597, ~: 188686) DagonTest:testFailBurnOverThreshold(address,uint96) (runs: 256, μ: 218849, ~: 219938) DagonTest:testFailInvalidThresholdExceedsSupply() (gas: 159129) @@ -13,22 +13,22 @@ DagonTest:testFailIsValidSignatureWeightedERC20() (gas: 235720) DagonTest:testFailIsValidSignatureWeightedERC6909() (gas: 227309) DagonTest:testFailIsValidSignatureWeightedERC721() (gas: 208941) DagonTest:testFailSetTokenInvalidStd(address) (runs: 256, μ: 158171, ~: 158171) -DagonTest:testFailTransferFromInactiveAuth(address,address,uint96) (runs: 256, μ: 192043, ~: 192899) -DagonTest:testFailTransferOverBalance(address,address,uint96) (runs: 256, μ: 186551, ~: 187407) +DagonTest:testFailTransferFromInactiveAuth(address,address,uint96) (runs: 256, μ: 192121, ~: 192899) +DagonTest:testFailTransferOverBalance(address,address,uint96) (runs: 256, μ: 186629, ~: 187407) DagonTest:testInstall() (gas: 137482) DagonTest:testIsValidSignature() (gas: 150958) DagonTest:testIsValidSignature2of3() (gas: 197462) DagonTest:testIsValidSignature3of3() (gas: 205252) DagonTest:testIsValidSignatureOnchain() (gas: 197623) DagonTest:testIsValidSignatureWeighted() (gas: 234909) -DagonTest:testIsValidSignatureWeightedERC1155() (gas: 247851) +DagonTest:testIsValidSignatureWeightedERC1155() (gas: 247860) DagonTest:testIsValidSignatureWeightedERC20() (gas: 247655) -DagonTest:testIsValidSignatureWeightedERC6909() (gas: 247825) +DagonTest:testIsValidSignatureWeightedERC6909() (gas: 247834) DagonTest:testIsValidSignatureWeightedERC721() (gas: 207552) DagonTest:testNameAndSymbolAndDecimals(uint256) (runs: 256, μ: 15035, ~: 15035) DagonTest:testSetAuth(address) (runs: 256, μ: 145746, ~: 145746) DagonTest:testSetThreshold() (gas: 147627) DagonTest:testSetToken(address) (runs: 256, μ: 148419, ~: 148419) DagonTest:testSetURI() (gas: 165149) -DagonTest:testTransfer(address,address,uint88) (runs: 256, μ: 176139, ~: 176995) -DagonTest:testTransferWithAuth(address,address,uint96) (runs: 256, μ: 180087, ~: 180943) \ No newline at end of file +DagonTest:testTransfer(address,address,uint88) (runs: 256, μ: 176217, ~: 176995) +DagonTest:testTransferWithAuth(address,address,uint96) (runs: 256, μ: 180136, ~: 180943) \ No newline at end of file diff --git a/src/Dagon.sol b/src/Dagon.sol index b989ed5..7fb633e 100644 --- a/src/Dagon.sol +++ b/src/Dagon.sol @@ -346,8 +346,8 @@ contract Dagon is ERC6909 { assembly ("memory-safe") { mstore(0x14, account) // Store the `account` argument. mstore(0x00, 0x70a08231000000000000000000000000) // `balanceOf(address)`. - if iszero(staticcall(gas(), token, 0x10, 0x24, 0x20, 0x20)) { revert(codesize(), 0x20) } - amount := mload(0x20) + if iszero(staticcall(gas(), token, 0x10, 0x24, 0x00, 0x20)) { revert(codesize(), 0x00) } + amount := mload(0x00) } } @@ -362,18 +362,18 @@ contract Dagon is ERC6909 { mstore(0x14, account) // Store the `account` argument. mstore(0x34, id) // Store the `id` argument. mstore(0x00, 0x00fdd58e000000000000000000000000) // `balanceOf(address,uint256)`. - if iszero(staticcall(gas(), token, 0x10, 0x44, 0x20, 0x20)) { revert(codesize(), 0x00) } - amount := mload(0x20) - mstore(0x34, 0) + if iszero(staticcall(gas(), token, 0x10, 0x44, 0x00, 0x20)) { revert(codesize(), 0x00) } + amount := mload(0x00) + mstore(0x34, 0x00) } } /// @dev Returns the total supply of ERC20/721 `token`. function _totalSupply(address token) internal view virtual returns (uint256 supply) { assembly ("memory-safe") { - mstore(0x00, 0x72dd529b00000000000000000000000000000000000000000000000000000000) // `totalSupply()`. - if iszero(staticcall(gas(), token, 0x00, 0x04, 0x20, 0x20)) { revert(codesize(), 0x00) } - supply := mload(0x20) + mstore(0x00, 0x72dd529b000000000000000000000000) // `totalSupply()`. + if iszero(staticcall(gas(), token, 0x10, 0x14, 0x00, 0x20)) { revert(codesize(), 0x00) } + supply := mload(0x00) } } @@ -387,8 +387,8 @@ contract Dagon is ERC6909 { assembly ("memory-safe") { mstore(0x04, id) // Store the `id` argument. mstore(0x00, 0x3f053e2d00000000000000000000000000000000000000000000000000000000) // `totalSupply(uint256)`. - if iszero(staticcall(gas(), token, 0x00, 0x24, 0x00, 0x20)) { revert(codesize(), 0x00) } - supply := mload(0x20) + if iszero(staticcall(gas(), token, 0x10, 0x24, 0x00, 0x20)) { revert(codesize(), 0x00) } + supply := mload(0x00) } }