-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
271 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
{ | ||
"abi": [ | ||
{ | ||
"constant": true, | ||
"inputs": [{ "name": "interfaceID", "type": "bytes4" }], | ||
"name": "supportsInterface", | ||
"outputs": [{ "name": "", "type": "bool" }], | ||
"payable": false, | ||
"type": "function" | ||
}, | ||
{ | ||
"constant": true, | ||
"inputs": [ | ||
{ "name": "node", "type": "bytes32" }, | ||
{ "name": "contentTypes", "type": "uint256" } | ||
], | ||
"name": "ABI", | ||
"outputs": [ | ||
{ "name": "contentType", "type": "uint256" }, | ||
{ "name": "data", "type": "bytes" } | ||
], | ||
"payable": false, | ||
"type": "function" | ||
}, | ||
{ | ||
"constant": false, | ||
"inputs": [ | ||
{ "name": "node", "type": "bytes32" }, | ||
{ "name": "x", "type": "bytes32" }, | ||
{ "name": "y", "type": "bytes32" } | ||
], | ||
"name": "setPubkey", | ||
"outputs": [], | ||
"payable": false, | ||
"type": "function" | ||
}, | ||
{ | ||
"constant": true, | ||
"inputs": [{ "name": "node", "type": "bytes32" }], | ||
"name": "content", | ||
"outputs": [{ "name": "ret", "type": "bytes32" }], | ||
"payable": false, | ||
"type": "function" | ||
}, | ||
{ | ||
"constant": true, | ||
"inputs": [{ "name": "node", "type": "bytes32" }], | ||
"name": "addr", | ||
"outputs": [{ "name": "ret", "type": "address" }], | ||
"payable": false, | ||
"type": "function" | ||
}, | ||
{ | ||
"constant": false, | ||
"inputs": [ | ||
{ "name": "node", "type": "bytes32" }, | ||
{ "name": "contentType", "type": "uint256" }, | ||
{ "name": "data", "type": "bytes" } | ||
], | ||
"name": "setABI", | ||
"outputs": [], | ||
"payable": false, | ||
"type": "function" | ||
}, | ||
{ | ||
"constant": true, | ||
"inputs": [{ "name": "node", "type": "bytes32" }], | ||
"name": "name", | ||
"outputs": [{ "name": "ret", "type": "string" }], | ||
"payable": false, | ||
"type": "function" | ||
}, | ||
{ | ||
"constant": false, | ||
"inputs": [ | ||
{ "name": "node", "type": "bytes32" }, | ||
{ "name": "name", "type": "string" } | ||
], | ||
"name": "setName", | ||
"outputs": [], | ||
"payable": false, | ||
"type": "function" | ||
}, | ||
{ | ||
"constant": false, | ||
"inputs": [ | ||
{ "name": "node", "type": "bytes32" }, | ||
{ "name": "hash", "type": "bytes32" } | ||
], | ||
"name": "setContent", | ||
"outputs": [], | ||
"payable": false, | ||
"type": "function" | ||
}, | ||
{ | ||
"constant": true, | ||
"inputs": [{ "name": "node", "type": "bytes32" }], | ||
"name": "pubkey", | ||
"outputs": [ | ||
{ "name": "x", "type": "bytes32" }, | ||
{ "name": "y", "type": "bytes32" } | ||
], | ||
"payable": false, | ||
"type": "function" | ||
}, | ||
{ | ||
"constant": false, | ||
"inputs": [ | ||
{ "name": "node", "type": "bytes32" }, | ||
{ "name": "addr", "type": "address" } | ||
], | ||
"name": "setAddr", | ||
"outputs": [], | ||
"payable": false, | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [{ "name": "ensAddr", "type": "address" }], | ||
"payable": false, | ||
"type": "constructor" | ||
}, | ||
{ | ||
"anonymous": false, | ||
"inputs": [ | ||
{ "indexed": true, "name": "node", "type": "bytes32" }, | ||
{ "indexed": false, "name": "a", "type": "address" } | ||
], | ||
"name": "AddrChanged", | ||
"type": "event" | ||
}, | ||
{ | ||
"anonymous": false, | ||
"inputs": [ | ||
{ "indexed": true, "name": "node", "type": "bytes32" }, | ||
{ "indexed": false, "name": "hash", "type": "bytes32" } | ||
], | ||
"name": "ContentChanged", | ||
"type": "event" | ||
}, | ||
{ | ||
"anonymous": false, | ||
"inputs": [ | ||
{ "indexed": true, "name": "node", "type": "bytes32" }, | ||
{ "indexed": false, "name": "name", "type": "string" } | ||
], | ||
"name": "NameChanged", | ||
"type": "event" | ||
}, | ||
{ | ||
"anonymous": false, | ||
"inputs": [ | ||
{ "indexed": true, "name": "node", "type": "bytes32" }, | ||
{ "indexed": true, "name": "contentType", "type": "uint256" } | ||
], | ||
"name": "ABIChanged", | ||
"type": "event" | ||
}, | ||
{ | ||
"anonymous": false, | ||
"inputs": [ | ||
{ "indexed": true, "name": "node", "type": "bytes32" }, | ||
{ "indexed": false, "name": "x", "type": "bytes32" }, | ||
{ "indexed": false, "name": "y", "type": "bytes32" } | ||
], | ||
"name": "PubkeyChanged", | ||
"type": "event" | ||
} | ||
], | ||
"bytecode": "0x6060604052341561000c57fe5b604051602080610dc583398101604052515b60008054600160a060020a031916600160a060020a0383161790555b505b610d7a8061004b6000396000f300606060405236156100ac5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166301ffc9a781146100ae5780632203ab56146100df57806329cd62ea146101815780632dff69411461019c5780633b3b57de146101c1578063623195b0146101f0578063691f34311461024c57806377372213146102df578063c3d014d614610338578063c869023314610350578063d5fa2b001461037c575bfe5b34156100b657fe5b6100cb600160e060020a03196004351661039d565b604080519115158252519081900360200190f35b34156100e757fe5b6100f56004356024356104d8565b6040518083815260200180602001828103825283818151815260200191508051906020019080838360008314610146575b80518252602083111561014657601f199092019160209182019101610126565b505050905090810190601f1680156101725780820380516001836020036101000a031916815260200191505b50935050505060405180910390f35b341561018957fe5b61019a6004356024356044356105ef565b005b34156101a457fe5b6101af6004356106e6565b60408051918252519081900360200190f35b34156101c957fe5b6101d46004356106ff565b60408051600160a060020a039092168252519081900360200190f35b34156101f857fe5b604080516020600460443581810135601f810184900484028501840190955284845261019a94823594602480359560649492939190920191819084018382808284375094965061071d95505050505050565b005b341561025457fe5b61025f600435610816565b6040805160208082528351818301528351919283929083019185019080838382156102a5575b8051825260208311156102a557601f199092019160209182019101610285565b505050905090810190601f1680156102d15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156102e757fe5b60408051602060046024803582810135601f810185900485028601850190965285855261019a95833595939460449493929092019181908401838280828437509496506108c195505050505050565b005b341561034057fe5b61019a600435602435610a19565b005b341561035857fe5b610363600435610af1565b6040805192835260208301919091528051918290030190f35b341561038457fe5b61019a600435600160a060020a0360243516610b10565b005b6000600160e060020a031982167f3b3b57de0000000000000000000000000000000000000000000000000000000014806104005750600160e060020a031982167fd8389dc500000000000000000000000000000000000000000000000000000000145b806104345750600160e060020a031982167f691f343100000000000000000000000000000000000000000000000000000000145b806104685750600160e060020a031982167f2203ab5600000000000000000000000000000000000000000000000000000000145b8061049c5750600160e060020a031982167fc869023300000000000000000000000000000000000000000000000000000000145b806104d05750600160e060020a031982167f01ffc9a700000000000000000000000000000000000000000000000000000000145b90505b919050565b60006104e2610c0b565b60008481526001602081905260409091209092505b8383116105e257828416158015906105305750600083815260058201602052604081205460026000196101006001841615020190911604115b156105d657600083815260058201602090815260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845290918301828280156105ca5780601f1061059f576101008083540402835291602001916105ca565b820191906000526020600020905b8154815290600101906020018083116105ad57829003601f168201915b505050505091506105e7565b5b6002909202916104f7565b600092505b509250929050565b60008054604080516020908101849052815160e060020a6302571be30281526004810188905291518794600160a060020a033381169516936302571be393602480830194919391928390030190829087803b151561064957fe5b6102c65a03f1151561065757fe5b505060405151600160a060020a03169190911490506106765760006000fd5b604080518082018252848152602080820185815260008881526001835284902092516003840155516004909201919091558151858152908101849052815186927f1d6f5e03d3f63eb58751986629a5439baee5079ff04f345becb66e23eb154e46928290030190a25b5b50505050565b600081815260016020819052604090912001545b919050565b600081815260016020526040902054600160a060020a03165b919050565b60008054604080516020908101849052815160e060020a6302571be30281526004810188905291518794600160a060020a033381169516936302571be393602480830194919391928390030190829087803b151561077757fe5b6102c65a03f1151561078557fe5b505060405151600160a060020a03169190911490506107a45760006000fd5b60001983018316156107b65760006000fd5b6000848152600160209081526040808320868452600501825290912083516107e092850190610c1d565b50604051839085907faa121bbeef5f32f5961a2a28966e769023910fc9479059ee3495d4c1a696efe390600090a35b5b50505050565b61081e610c0b565b6000828152600160208181526040928390206002908101805485516000199582161561010002959095011691909104601f81018390048302840183019094528383529192908301828280156108b45780601f10610889576101008083540402835291602001916108b4565b820191906000526020600020905b81548152906001019060200180831161089757829003601f168201915b505050505090505b919050565b60008054604080516020908101849052815160e060020a6302571be30281526004810187905291518694600160a060020a033381169516936302571be393602480830194919391928390030190829087803b151561091b57fe5b6102c65a03f1151561092957fe5b505060405151600160a060020a03169190911490506109485760006000fd5b6000838152600160209081526040909120835161096d92600290920191850190610c1d565b50604080516020808252845181830152845186937fb7d29e911041e8d9b843369e890bcb72c9388692ba48b65ac54e7214c4c348f79387939092839283019185019080838382156109d9575b8051825260208311156109d957601f1990920191602091820191016109b9565b505050905090810190601f168015610a055780820380516001836020036101000a031916815260200191505b509250505060405180910390a25b5b505050565b60008054604080516020908101849052815160e060020a6302571be30281526004810187905291518694600160a060020a033381169516936302571be393602480830194919391928390030190829087803b1515610a7357fe5b6102c65a03f11515610a8157fe5b505060405151600160a060020a0316919091149050610aa05760006000fd5b6000838152600160208181526040928390209091018490558151848152915185927f0424b6fe0d9c3bdbece0e7879dc241bb0c22e900be8b6c168b4ee08bd9bf83bc92908290030190a25b5b505050565b600081815260016020526040902060038101546004909101545b915091565b60008054604080516020908101849052815160e060020a6302571be30281526004810187905291518694600160a060020a033381169516936302571be393602480830194919391928390030190829087803b1515610b6a57fe5b6102c65a03f11515610b7857fe5b505060405151600160a060020a0316919091149050610b975760006000fd5b600083815260016020908152604091829020805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0386169081179091558251908152915185927f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd292908290030190a25b5b505050565b60408051602081019091526000815290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610c5e57805160ff1916838001178555610c8b565b82800160010185558215610c8b579182015b82811115610c8b578251825591602001919060010190610c70565b5b50610c98929150610d2d565b5090565b60408051602081019091526000815290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610c5e57805160ff1916838001178555610c8b565b82800160010185558215610c8b579182015b82811115610c8b578251825591602001919060010190610c70565b5b50610c98929150610d2d565b5090565b610d4b91905b80821115610c985760008155600101610d33565b5090565b905600a165627a7a72305820f05b42978350d3945a3fe885ef530e3f8ecbfcdb822550779dfcf0b06b00754f0029" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
/* eslint-disable no-await-in-loop */ | ||
const fs = require('fs/promises') | ||
const { ethers } = require('hardhat') | ||
const { resolve } = require('path') | ||
const { namehash } = require('viem') | ||
|
||
const names = [ | ||
{ | ||
namedOwner: 'owner', | ||
name: 'with-oldest-resolver.eth', | ||
addr: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8', | ||
}, | ||
] | ||
|
||
/** | ||
* @type {import('hardhat-deploy/types').DeployFunction} | ||
*/ | ||
const func = async function (hre) { | ||
const { getNamedAccounts, deployments } = hre | ||
const allNamedAccts = await getNamedAccounts() | ||
|
||
const registry = await ethers.getContract('ENSRegistry') | ||
|
||
await deployments.deploy('OldestResolver', { | ||
from: allNamedAccts.deployer, | ||
contract: JSON.parse( | ||
await fs.readFile( | ||
resolve(__dirname, '../contracts/OldestResolver.json'), | ||
{ | ||
encoding: 'utf8', | ||
}, | ||
), | ||
), | ||
args: [registry.address], | ||
}) | ||
|
||
const resolver = await ethers.getContract('OldestResolver') | ||
|
||
for (const { namedOwner, name, addr } of names) { | ||
const owner = allNamedAccts[namedOwner] | ||
const _resolver = resolver.connect(await ethers.getSigner(owner)) | ||
const _registry = registry.connect(await ethers.getSigner(owner)) | ||
|
||
const tx = await _registry.setResolver(namehash(name), resolver.address) | ||
console.log( | ||
`Setting resolver for ${name} to ${resolver.address} (tx: ${tx.hash})...`, | ||
) | ||
await tx.wait() | ||
|
||
const tx2 = await _resolver['setAddr(bytes32,address)']( | ||
namehash(name), | ||
addr, | ||
{ | ||
gasLimit: 100000, | ||
}, | ||
) | ||
console.log(`Setting address for 60 to ${addr} (tx: ${tx.hash})...`) | ||
await tx2.wait() | ||
} | ||
|
||
return true | ||
} | ||
|
||
func.id = 'set-oldest-resolver' | ||
func.tags = ['set-oldest-resolver'] | ||
func.runAtTheEnd = true | ||
|
||
module.exports = func |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters