Verified contractPartialBUSL-1.1
ArrayMappingUint256
Address0x5589c1a93ad9c910eeb31496f514b0def2cc0b3d
- Balance
0 ETH
- Transactions
1
- Compiler
solc 0.8.17
- Same code
Only this contract
Details
- Compiler
- solc 0.8.17+commit.8df45f5f
- Language
- solidity
- Optimization
- Yes, 99,999 runs
- EVM version
- london
- License
- BUSL-1.1
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 17,883,044
- Creation transaction
- 0xf465bb998b…4ec59ed539
- Libraries
- src/libraries/SpoolUtils.sol:SpoolUtils0xee27…35d81escript/helper/ArraysHelper.sol:ArraysHelper0x9207…f6b18csrc/libraries/ArrayMapping.sol:ArrayMappingUint2560x5589…cc0b3d
src/libraries/ArrayMapping.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.17;
library ArrayMappingUint256 {
/**
* @notice Map mapping(uint256 => uint256)) values to an array.
*/
function toArray(mapping(uint256 => uint256) storage _self, uint256 length)
external
view
returns (uint256[] memory)
{
uint256[] memory arrayOut = new uint256[](length);
for (uint256 i; i < length; ++i) {
arrayOut[i] = _self[i];
}
return arrayOut;
}
/**
* @notice Set array values to mapping slots.
*/
function setValues(mapping(uint256 => uint256) storage _self, uint256[] calldata values) external {
for (uint256 i; i < values.length; ++i) {
_self[i] = values[i];
}
}
}
library ArrayMappingAddress {
/**
* @notice Map mapping(uint256 => address)) values to an array.
*/
function toArray(mapping(uint256 => address) storage _self, uint256 length)
external
view
returns (address[] memory)
{
address[] memory arrayOut = new address[](length);
for (uint256 i; i < length; ++i) {
arrayOut[i] = _self[i];
}
return arrayOut;
}
/**
* @notice Set array values to mapping slots.
*/
function setValues(mapping(uint256 => address) storage _self, address[] calldata values) external {
for (uint256 i; i < values.length; ++i) {
_self[i] = values[i];
}
}
}
Compiler settingsShow
{
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": false
},
"libraries": {
"src/libraries/SpoolUtils.sol": {
"SpoolUtils": "0xee2748274586db8e4a227f39b1fd95f5ed35d81e"
},
"script/helper/ArraysHelper.sol": {
"ArraysHelper": "0x92076039b4b69576e99e338899f76dfc19f6b18c"
},
"src/libraries/ArrayMapping.sol": {
"ArrayMappingUint256": "0x5589c1a93ad9c910eeb31496f514b0def2cc0b3d"
}
},
"optimizer": {
"runs": 99999,
"enabled": true
},
"evmVersion": "london",
"remappings": [
"@openzeppelin-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
"@openzeppelin/=lib/openzeppelin-contracts/contracts/",
"@solmate/=lib/solmate/src/",
"create3/=lib/create3/contracts/",
"ds-test/=lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"forge-std/=lib/forge-std/src/",
"openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/",
"solmate/=lib/solmate/src/",
"sstore2/=lib/sstore2/contracts/",
"lib/forge-std:ds-test/=lib/forge-std/lib/ds-test/src/",
"lib/openzeppelin-contracts:ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
"lib/openzeppelin-contracts:erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"lib/openzeppelin-contracts:forge-std/=lib/openzeppelin-contracts/lib/forge-std/src/",
"lib/openzeppelin-contracts-upgradeable:ds-test/=lib/openzeppelin-contracts-upgradeable/lib/forge-std/lib/ds-test/src/",
"lib/openzeppelin-contracts-upgradeable:forge-std/=lib/openzeppelin-contracts-upgradeable/lib/forge-std/src/",
"lib/solmate:ds-test/=lib/solmate/lib/ds-test/src/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.