upgradable ERC721

pull/2895/head
Aniket-Engg 2 years ago
parent 1b23c371b7
commit 516f40ec0d
  1. 1
      libs/remix-ui/workspace/src/lib/actions/workspace.ts
  2. 9
      libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx
  3. 1
      libs/remix-ws-templates/src/templates/ozerc20/index.ts
  4. 4
      libs/remix-ws-templates/src/templates/ozerc721/index.ts

@ -46,7 +46,6 @@ export const addInputField = async (type: 'file' | 'folder', path: string, cb?:
export const createWorkspace = async (workspaceName: string, workspaceTemplateName: WorkspaceTemplate, opts = null, isEmpty = false, cb?: (err: Error, result?: string | number | boolean | Record<string, any>) => void, isGitRepo: boolean = false) => { export const createWorkspace = async (workspaceName: string, workspaceTemplateName: WorkspaceTemplate, opts = null, isEmpty = false, cb?: (err: Error, result?: string | number | boolean | Record<string, any>) => void, isGitRepo: boolean = false) => {
await plugin.fileManager.closeAllFiles() await plugin.fileManager.closeAllFiles()
const promise = createWorkspaceTemplate(workspaceName, workspaceTemplateName) const promise = createWorkspaceTemplate(workspaceName, workspaceTemplateName)
console.log('opts-->', opts)
dispatch(createWorkspaceRequest(promise)) dispatch(createWorkspaceRequest(promise))
promise.then(async () => { promise.then(async () => {
dispatch(createWorkspaceSuccess({ name: workspaceName, isGitRepo })) dispatch(createWorkspaceSuccess({ name: workspaceName, isGitRepo }))

@ -106,7 +106,7 @@ export function Workspace () {
const workspaceName = workspaceCreateInput.current.value const workspaceName = workspaceCreateInput.current.value
// @ts-ignore: Object is possibly 'null'. // @ts-ignore: Object is possibly 'null'.
const workspaceTemplateName = workspaceCreateTemplateInput.current.value || 'remixDefault' const workspaceTemplateName = workspaceCreateTemplateInput.current.value || 'remixDefault'
console.log('upgradeable.current--->', upgradeable.current)
const opts = { const opts = {
upgradeable: upgradeable.current upgradeable: upgradeable.current
} }
@ -147,7 +147,6 @@ export function Workspace () {
// @ts-ignore // @ts-ignore
if (workspaceCreateTemplateInput.current.value.startsWith('oz')) setDisplayOzCustoms(true) if (workspaceCreateTemplateInput.current.value.startsWith('oz')) setDisplayOzCustoms(true)
else setDisplayOzCustoms(false) else setDisplayOzCustoms(false)
console.log('inside updateWsName', displayOzCustoms)
// @ts-ignore // @ts-ignore
workspaceCreateInput.current.value = `${workspaceCreateTemplateInput.current.value || 'remixDefault'}_${Date.now()}` workspaceCreateInput.current.value = `${workspaceCreateTemplateInput.current.value || 'remixDefault'}_${Date.now()}`
} }
@ -166,8 +165,7 @@ export function Workspace () {
setShowDropdown(isOpen) setShowDropdown(isOpen)
} }
const handleUpgradeChange = (e) => { const handleUpgradeability = (e) => {
console.log('selected option', e.target.value)
// @ts-ignore // @ts-ignore
upgradeable.current = e.target.value upgradeable.current = e.target.value
} }
@ -194,7 +192,7 @@ export function Workspace () {
<label className="form-check-label">Customize template</label><br/><br/> <label className="form-check-label">Customize template</label><br/><br/>
<label id="wsName" className="form-check-label">Upgradeability</label><br/> <label id="wsName" className="form-check-label">Upgradeability</label><br/>
<div onChange={(e) => handleUpgradeChange(e)}> <div onChange={(e) => handleUpgradeability(e)}>
<div className="d-flex ml-2 custom-control custom-radio"> <div className="d-flex ml-2 custom-control custom-radio">
<input className="custom-control-input" type="radio" name="upgradeability" value="transparent" id="transparent" /> <input className="custom-control-input" type="radio" name="upgradeability" value="transparent" id="transparent" />
<label className="form-check-label custom-control-label" htmlFor="transparent" data-id="upgradeTypeTransparent" >Transparent</label> <label className="form-check-label custom-control-label" htmlFor="transparent" data-id="upgradeTypeTransparent" >Transparent</label>
@ -206,6 +204,7 @@ export function Workspace () {
</div> </div>
</div> </div>
<br/> <br/>
<label id="wsName" className="form-check-label">Workspace name</label> <label id="wsName" className="form-check-label">Workspace name</label>
<input type="text" data-id="modalDialogCustomPromptTextCreate" defaultValue={`remixDefault_${Date.now()}`} ref={workspaceCreateInput} className="form-control" /> <input type="text" data-id="modalDialogCustomPromptTextCreate" defaultValue={`remixDefault_${Date.now()}`} ref={workspaceCreateInput} className="form-control" />
</> </>

@ -1,7 +1,6 @@
import { erc20 } from '@openzeppelin/wizard'; import { erc20 } from '@openzeppelin/wizard';
export default async (opts) => { export default async (opts) => {
console.log('opts---->', opts)
return { return {
'contracts/MyToken.sol': erc20.print({ ...erc20.defaults, upgradeable: opts.upgradeable}), 'contracts/MyToken.sol': erc20.print({ ...erc20.defaults, upgradeable: opts.upgradeable}),
// @ts-ignore // @ts-ignore

@ -1,8 +1,8 @@
import { erc721 } from '@openzeppelin/wizard'; import { erc721 } from '@openzeppelin/wizard';
export default async () => { export default async (opts) => {
return { return {
'contracts/MyToken.sol': erc721.print(), 'contracts/MyToken.sol': erc721.print({ ...erc721.defaults, upgradeable: opts.upgradeable}),
// @ts-ignore // @ts-ignore
'scripts/deploy_with_ethers.ts': (await import('!!raw-loader!./scripts/deploy_with_ethers.ts')).default, 'scripts/deploy_with_ethers.ts': (await import('!!raw-loader!./scripts/deploy_with_ethers.ts')).default,
// @ts-ignore // @ts-ignore

Loading…
Cancel
Save