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) => {
await plugin.fileManager.closeAllFiles()
const promise = createWorkspaceTemplate(workspaceName, workspaceTemplateName)
console.log('opts-->', opts)
dispatch(createWorkspaceRequest(promise))
promise.then(async () => {
dispatch(createWorkspaceSuccess({ name: workspaceName, isGitRepo }))

@ -106,7 +106,7 @@ export function Workspace () {
const workspaceName = workspaceCreateInput.current.value
// @ts-ignore: Object is possibly 'null'.
const workspaceTemplateName = workspaceCreateTemplateInput.current.value || 'remixDefault'
console.log('upgradeable.current--->', upgradeable.current)
const opts = {
upgradeable: upgradeable.current
}
@ -147,7 +147,6 @@ export function Workspace () {
// @ts-ignore
if (workspaceCreateTemplateInput.current.value.startsWith('oz')) setDisplayOzCustoms(true)
else setDisplayOzCustoms(false)
console.log('inside updateWsName', displayOzCustoms)
// @ts-ignore
workspaceCreateInput.current.value = `${workspaceCreateTemplateInput.current.value || 'remixDefault'}_${Date.now()}`
}
@ -166,8 +165,7 @@ export function Workspace () {
setShowDropdown(isOpen)
}
const handleUpgradeChange = (e) => {
console.log('selected option', e.target.value)
const handleUpgradeability = (e) => {
// @ts-ignore
upgradeable.current = e.target.value
}
@ -194,7 +192,7 @@ export function Workspace () {
<label className="form-check-label">Customize template</label><br/><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">
<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>
@ -206,6 +204,7 @@ export function Workspace () {
</div>
</div>
<br/>
<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" />
</>

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

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

Loading…
Cancel
Save