Skip to content

Commit

Permalink
🪡 Sew ~~
Browse files Browse the repository at this point in the history
  • Loading branch information
z0r0z committed Jan 10, 2024
1 parent ba4d8bc commit 03e33ff
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
14 changes: 7 additions & 7 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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)
DagonTest:testTransfer(address,address,uint88) (runs: 256, μ: 176217, ~: 176995)
DagonTest:testTransferWithAuth(address,address,uint96) (runs: 256, μ: 180136, ~: 180943)
20 changes: 10 additions & 10 deletions src/Dagon.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand All @@ -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)
}
}

Expand All @@ -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)
}
}

Expand Down

0 comments on commit 03e33ff

Please sign in to comment.