Skip to content

Commit

Permalink
deploy the dmap maybe (#109)
Browse files Browse the repository at this point in the history
* LOCK->LOCKED

* maybe deploy
  • Loading branch information
nmushegian authored May 1, 2022
1 parent e563bce commit 5d9510a
Show file tree
Hide file tree
Showing 9 changed files with 382 additions and 65 deletions.
12 changes: 6 additions & 6 deletions core/dmap.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
pragma solidity 0.8.13;

interface Dmap {
error LOCK();
error LOCKED();
event Set(
address indexed zone,
bytes32 indexed name,
Expand All @@ -19,10 +19,10 @@ interface Dmap {
}

contract _dmap_ {
error LOCK();
uint256 constant FLAG_LOCK = 0x1;
error LOCKED();
uint256 constant LOCK = 0x1;
constructor(address rootzone) { assembly {
sstore(0, FLAG_LOCK)
sstore(0, LOCK)
sstore(1, shl(96, rootzone))
}}
fallback() external payable { assembly {
Expand All @@ -39,12 +39,12 @@ contract _dmap_ {
let slot := keccak256(0, 64)
log4(0, 0, caller(), name, meta, data)
sstore(add(slot, 1), data)
if iszero(or(xor(100, calldatasize()), and(FLAG_LOCK, sload(slot)))) {
if iszero(or(xor(100, calldatasize()), and(LOCK, sload(slot)))) {
sstore(slot, meta)
return(0, 0)
}
if eq(100, calldatasize()) {
mstore(0, shl(224, 0xa4f0d7d0))
mstore(0, shl(224, 0xa1422f69))
revert(0, 4)
}
revert(0, 0)
Expand Down
6 changes: 3 additions & 3 deletions pack/Dmap.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"abi": [
{
"inputs": [],
"name": "LOCK",
"name": "LOCKED",
"type": "error"
},
{
Expand Down Expand Up @@ -87,8 +87,8 @@
"type": "function"
}
],
"bytecode": "0x608060405234801561001057600080fd5b5060405161012e38038061012e83398101604081905261002f91610041565b60016000558060601b60015550610071565b60006020828403121561005357600080fd5b81516001600160a01b038116811461006a57600080fd5b9392505050565b60af8061007f6000396000f3fe608060405236602403602257600435546000526004356001015460205260406000f35b6004356024356044353360005282602052604060002081838533600080a481600182015580546001163660641817605857828155005b505050503660640360745763a4f0d7d060e01b60005260046000fd5b600080fdfea2646970667358221220ab38dae29c8e3a88667c53a1ce72fc8257ebbc5abf63ac31cdd6f933dbfb68ad64736f6c634300080d0033",
"deployedBytecode": "0x608060405236602403602257600435546000526004356001015460205260406000f35b6004356024356044353360005282602052604060002081838533600080a481600182015580546001163660641817605857828155005b505050503660640360745763a4f0d7d060e01b60005260046000fd5b600080fdfea2646970667358221220ab38dae29c8e3a88667c53a1ce72fc8257ebbc5abf63ac31cdd6f933dbfb68ad64736f6c634300080d0033",
"bytecode": "0x608060405234801561001057600080fd5b5060405161012e38038061012e83398101604081905261002f91610041565b60016000558060601b60015550610071565b60006020828403121561005357600080fd5b81516001600160a01b038116811461006a57600080fd5b9392505050565b60af8061007f6000396000f3fe608060405236602403602257600435546000526004356001015460205260406000f35b6004356024356044353360005282602052604060002081838533600080a481600182015580546001163660641817605857828155005b505050503660640360745763a1422f6960e01b60005260046000fd5b600080fdfea2646970667358221220475e238f09c07b2df011287cd0b887d9e0864657776ab6a3484c43f79237fefa64736f6c634300080d0033",
"deployedBytecode": "0x608060405236602403602257600435546000526004356001015460205260406000f35b6004356024356044353360005282602052604060002081838533600080a481600182015580546001163660641817605857828155005b505050503660640360745763a1422f6960e01b60005260046000fd5b600080fdfea2646970667358221220475e238f09c07b2df011287cd0b887d9e0864657776ab6a3484c43f79237fefa64736f6c634300080d0033",
"linkReferences": {},
"deployedLinkReferences": {}
}
146 changes: 146 additions & 0 deletions pack/FreeZone.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
{
"_format": "hh-sol-artifact-1",
"contractName": "FreeZone",
"sourceName": "core/free.sol",
"abi": [
{
"inputs": [
{
"internalType": "contract Dmap",
"name": "d",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "giver",
"type": "address"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "zone",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "recipient",
"type": "address"
}
],
"name": "Give",
"type": "event"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"name": "controllers",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "dmap",
"outputs": [
{
"internalType": "contract Dmap",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "key",
"type": "bytes32"
},
{
"internalType": "address",
"name": "recipient",
"type": "address"
}
],
"name": "give",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "last",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "key",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "meta",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "data",
"type": "bytes32"
}
],
"name": "set",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "key",
"type": "bytes32"
}
],
"name": "take",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
],
"bytecode": "0x60a060405234801561001057600080fd5b5060405161065938038061065983398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516105c8610091600039600081816098015261032b01526105c86000f3fe608060405234801561001057600080fd5b50600436106100725760003560e01c8063bb40a4a911610050578063bb40a4a9146100f4578063cc9ae69314610107578063fbae406a1461011a57600080fd5b806347799da81461007757806396aab0db14610093578063baa8529c146100df575b600080fd5b61008060005481565b6040519081526020015b60405180910390f35b6100ba7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161008a565b6100f26100ed366004610504565b610150565b005b6100f261010236600461054d565b610261565b6100f2610115366004610579565b6103a1565b6100ba610128366004610579565b60016020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60008281526001602052604090205473ffffffffffffffffffffffffffffffffffffffff1633146101e2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4552525f4f574e4552000000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b60008281526001602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff851690811790915590519091849133917f233a12001d1b536e640acdd9d00a3f54c2bc6f66404065ba43cc2e84b6ee3d0191a45050565b60008381526001602052604090205473ffffffffffffffffffffffffffffffffffffffff1633146102ee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4552525f4f574e4552000000000000000000000000000000000000000000000060448201526064016101d9565b6040517fbb40a4a90000000000000000000000000000000000000000000000000000000081526004810184905260248101839052604481018290527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169063bb40a4a990606401600060405180830381600087803b15801561038457600080fd5b505af1158015610398573d6000803e3d6000fd5b50505050505050565b60008181526001602052604090205473ffffffffffffffffffffffffffffffffffffffff161561042d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4552525f54414b454e000000000000000000000000000000000000000000000060448201526064016101d9565b6000544211610498576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4552525f4c494d4954000000000000000000000000000000000000000000000060448201526064016101d9565b4260009081558181526001602052604080822080547fffffffffffffffffffffffff000000000000000000000000000000000000000016339081179091559051909183917f233a12001d1b536e640acdd9d00a3f54c2bc6f66404065ba43cc2e84b6ee3d01908290a450565b6000806040838503121561051757600080fd5b82359150602083013573ffffffffffffffffffffffffffffffffffffffff8116811461054257600080fd5b809150509250929050565b60008060006060848603121561056257600080fd5b505081359360208301359350604090920135919050565b60006020828403121561058b57600080fd5b503591905056fea2646970667358221220f2aff6925acfd74cc31810d5e7dfba5583c6e28eaeed2cef7ed28a757c7d94ec64736f6c634300080d0033",
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100725760003560e01c8063bb40a4a911610050578063bb40a4a9146100f4578063cc9ae69314610107578063fbae406a1461011a57600080fd5b806347799da81461007757806396aab0db14610093578063baa8529c146100df575b600080fd5b61008060005481565b6040519081526020015b60405180910390f35b6100ba7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161008a565b6100f26100ed366004610504565b610150565b005b6100f261010236600461054d565b610261565b6100f2610115366004610579565b6103a1565b6100ba610128366004610579565b60016020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60008281526001602052604090205473ffffffffffffffffffffffffffffffffffffffff1633146101e2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4552525f4f574e4552000000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b60008281526001602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff851690811790915590519091849133917f233a12001d1b536e640acdd9d00a3f54c2bc6f66404065ba43cc2e84b6ee3d0191a45050565b60008381526001602052604090205473ffffffffffffffffffffffffffffffffffffffff1633146102ee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4552525f4f574e4552000000000000000000000000000000000000000000000060448201526064016101d9565b6040517fbb40a4a90000000000000000000000000000000000000000000000000000000081526004810184905260248101839052604481018290527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169063bb40a4a990606401600060405180830381600087803b15801561038457600080fd5b505af1158015610398573d6000803e3d6000fd5b50505050505050565b60008181526001602052604090205473ffffffffffffffffffffffffffffffffffffffff161561042d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4552525f54414b454e000000000000000000000000000000000000000000000060448201526064016101d9565b6000544211610498576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4552525f4c494d4954000000000000000000000000000000000000000000000060448201526064016101d9565b4260009081558181526001602052604080822080547fffffffffffffffffffffffff000000000000000000000000000000000000000016339081179091559051909183917f233a12001d1b536e640acdd9d00a3f54c2bc6f66404065ba43cc2e84b6ee3d01908290a450565b6000806040838503121561051757600080fd5b82359150602083013573ffffffffffffffffffffffffffffffffffffffff8116811461054257600080fd5b809150509250929050565b60008060006060848603121561056257600080fd5b505081359360208301359350604090920135919050565b60006020828403121561058b57600080fd5b503591905056fea2646970667358221220f2aff6925acfd74cc31810d5e7dfba5583c6e28eaeed2cef7ed28a757c7d94ec64736f6c634300080d0033",
"linkReferences": {},
"deployedLinkReferences": {}
}
Loading

0 comments on commit 5d9510a

Please sign in to comment.