-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #111 from metagov/deploy-graph-on-optimism-goerli
Deploy TheGraph Indexer on optimism-goerli
- Loading branch information
Showing
6 changed files
with
150 additions
and
129 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
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
228 changes: 106 additions & 122 deletions
228
daostar-website/src/components/Register/RegistrationReceived/RegistrationReceived.js
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 |
---|---|---|
@@ -1,128 +1,112 @@ | ||
import React, { Fragment } from 'react'; | ||
import { Button, Divider, FormGroup, TextArea } from '@blueprintjs/core'; | ||
import { useWeb3Modal } from '@web3modal/react'; | ||
import { ethers } from 'ethers'; | ||
import RegistrationContract from '../../../abi/RegistrationContract'; | ||
import CopyField from '../../ui/CopyField/CopyField'; | ||
import React, { Fragment } from "react"; | ||
import { Button, Divider, FormGroup, TextArea } from "@blueprintjs/core"; | ||
import { useWeb3Modal } from "@web3modal/react"; | ||
import { ethers } from "ethers"; | ||
import RegistrationContract from "../../../abi/RegistrationContract"; | ||
import CopyField from "../../ui/CopyField/CopyField"; | ||
|
||
const RegistrationReceived = ({ | ||
daoURI, | ||
daoContractAddress, | ||
daoContractNetwork, | ||
isUpdate = false | ||
daoURI, | ||
daoContractAddress, | ||
daoContractNetwork, | ||
isUpdate = false, | ||
}) => { | ||
const { isOpen, open } = useWeb3Modal(); | ||
const factoryContracts = { | ||
mainnet: `0x2dac5dbbf1d024c1e0d9c92d3aeda7618e15add7`, | ||
goerli: `0x3271b3479f7485dadb2bd5fff43eeb4367b1a91a`, | ||
gnosis: `0x4f2c9028fe7107d9f1a8a9cff34aa2d3f28600fa`, | ||
polygon: `0x37dF3fC47C1c3A2acaFd2Dad9c1C00090a8655Bc`, | ||
optimism: `0x37dF3fC47C1c3A2acaFd2Dad9c1C00090a8655Bc`, | ||
optimismGoerli: `0x45E81552DEC1F57c18E3cbd69549252624b96D98` | ||
}; | ||
|
||
const { isOpen, open } = useWeb3Modal(); | ||
const factoryContracts = { | ||
mainnet: `0x2dac5dbbf1d024c1e0d9c92d3aeda7618e15add7`, | ||
goerli: `0x3271b3479f7485dadb2bd5fff43eeb4367b1a91a`, | ||
gnosis: `0x4f2c9028fe7107d9f1a8a9cff34aa2d3f28600fa`, | ||
polygon: `0x37dF3fC47C1c3A2acaFd2Dad9c1C00090a8655Bc`, | ||
optimism: `0x37dF3fC47C1c3A2acaFd2Dad9c1C00090a8655Bc` | ||
} | ||
const regContract = new ethers.Contract( | ||
`0x5ef59b7cDe41b744f36b6e07fEF230884F800529`, | ||
RegistrationContract | ||
); | ||
const saltNumber = Math.floor(100000000000 + Math.random() * 900000000000); | ||
const salt = `0x${saltNumber}0000000000000000000000000000000000000000000000000000`; // TODO: generate salt | ||
console.log("salt", salt); | ||
const managerExample = `0x5ef59b7cDe41b744f36b6e07fEF230884F800529`; | ||
const contracts = []; | ||
const bytes = []; | ||
const daoIPFS_URI = `ipfs://${daoURI.substring( | ||
daoURI.indexOf(`immutable/`) + 10 | ||
)}`; | ||
console.log("ipfs", daoIPFS_URI); | ||
const regData = [salt, daoIPFS_URI, managerExample, contracts, bytes]; | ||
const rawRegData = regContract.interface.encodeFunctionData( | ||
"summonRegistration", | ||
[...regData] | ||
); | ||
|
||
const regContract = new ethers.Contract(`0x5ef59b7cDe41b744f36b6e07fEF230884F800529`, RegistrationContract); | ||
const saltNumber = Math.floor(100000000000 + Math.random() * 900000000000) | ||
const salt = `0x${saltNumber}0000000000000000000000000000000000000000000000000000`; // TODO: generate salt | ||
console.log('salt', salt); | ||
const managerExample = `0x5ef59b7cDe41b744f36b6e07fEF230884F800529`; | ||
const contracts = []; | ||
const bytes = []; | ||
const daoIPFS_URI = `ipfs://${daoURI.substring(daoURI.indexOf(`immutable/`) + 10)}`; | ||
console.log('ipfs', daoIPFS_URI); | ||
const regData = [ | ||
salt, | ||
daoIPFS_URI, | ||
managerExample, | ||
contracts, | ||
bytes | ||
] | ||
const rawRegData = regContract.interface.encodeFunctionData("summonRegistration", [...regData]); | ||
return ( | ||
<Fragment> | ||
<h3> | ||
{isUpdate ? "Updated registration received" : "Registration received!"} | ||
</h3> | ||
<Divider vertical={true} /> | ||
<div className="wizard-row wizard-center"> | ||
<p className="wizard-margin-bottom-8">Your DAO URI has been created.</p> | ||
<div className="wizard-margin-bottom-8"> | ||
<CopyField text={daoURI} /> | ||
</div> | ||
<p className="wizard-margin-bottom-8"> | ||
To complete registration, propose this transaction to your DAO: | ||
</p> | ||
<Button | ||
disabled | ||
className="wizard-margin-bottom-8" | ||
intent="primary" | ||
text="Connect as DAO (coming soon)" | ||
onClick={open} | ||
loading={isOpen} | ||
/> | ||
</div> | ||
<Divider vertical={true} /> | ||
<div className="wizard-row"> | ||
<p className="wizard-center"> | ||
Or, manually copy transaction to your DAO: | ||
</p> | ||
</div> | ||
<div className="wizard-row"> | ||
<FormGroup label="Address" labelFor="address"> | ||
<CopyField | ||
id="address" | ||
fill={true} | ||
text={factoryContracts[daoContractNetwork]} | ||
/> | ||
</FormGroup> | ||
</div> | ||
<div className="wizard-row"> | ||
<FormGroup label="Value" labelFor="value"> | ||
<CopyField fill id="value" text={"0"} /> | ||
</FormGroup> | ||
</div> | ||
<div className="wizard-row"> | ||
<FormGroup label="Function" labelFor="function"> | ||
<CopyField | ||
fill | ||
id="function" | ||
text={`summonRegistration(bytes32 salt,string daoURI_,address manager,address[] contracts,bytes[] data)`} | ||
/> | ||
</FormGroup> | ||
</div> | ||
<div className="wizard-row"> | ||
<FormGroup label="Call Data" labelFor="call-data"> | ||
<TextArea | ||
fill | ||
// disabled | ||
id="advanced-settings" | ||
value={rawRegData} | ||
growVertically | ||
style={{ minHeight: 200 }} | ||
/> | ||
</FormGroup> | ||
</div> | ||
</Fragment> | ||
); | ||
}; | ||
|
||
return ( | ||
<Fragment> | ||
<h3>{isUpdate ? 'Updated registration received' : 'Registration received!'}</h3> | ||
<Divider vertical={true} /> | ||
<div className='wizard-row wizard-center'> | ||
<p className='wizard-margin-bottom-8'> | ||
Your DAO URI has been created. | ||
</p> | ||
<div className='wizard-margin-bottom-8'> | ||
<CopyField | ||
text={daoURI} | ||
/> | ||
</div> | ||
<p className='wizard-margin-bottom-8'> | ||
To complete registration, propose this transaction to your DAO: | ||
</p> | ||
<Button | ||
disabled | ||
className='wizard-margin-bottom-8' | ||
intent='primary' | ||
text='Connect as DAO (coming soon)' | ||
onClick={open} | ||
loading={isOpen} | ||
/> | ||
</div> | ||
<Divider vertical={true} /> | ||
<div className='wizard-row'> | ||
<p className='wizard-center'> | ||
Or, manually copy transaction to your DAO: | ||
</p> | ||
</div> | ||
<div className='wizard-row'> | ||
<FormGroup | ||
label='Address' | ||
labelFor='address' | ||
> | ||
<CopyField | ||
id='address' | ||
fill={true} | ||
text={factoryContracts[daoContractNetwork]} | ||
/> | ||
</FormGroup> | ||
</div> | ||
<div className='wizard-row'> | ||
<FormGroup | ||
label='Value' | ||
labelFor='value' | ||
> | ||
<CopyField | ||
fill | ||
id='value' | ||
text={'0'} | ||
/> | ||
</FormGroup> | ||
</div> | ||
<div className='wizard-row'> | ||
<FormGroup | ||
label='Function' | ||
labelFor='function' | ||
> | ||
<CopyField | ||
fill | ||
id='function' | ||
text={`summonRegistration(bytes32 salt,string daoURI_,address manager,address[] contracts,bytes[] data)`} | ||
/> | ||
</FormGroup> | ||
</div> | ||
<div className='wizard-row'> | ||
<FormGroup | ||
label='Call Data' | ||
labelFor='call-data' | ||
> | ||
<TextArea | ||
fill | ||
// disabled | ||
id='advanced-settings' | ||
value={rawRegData} | ||
growVertically | ||
style={{ minHeight: 200 }} | ||
/> | ||
</FormGroup> | ||
</div> | ||
</Fragment> | ||
) | ||
} | ||
|
||
export default RegistrationReceived; | ||
export default RegistrationReceived; |
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