Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify storage of contract source code #61

Open
wants to merge 7 commits into
base: contract-source-code
Choose a base branch
from

Conversation

kroggen
Copy link
Member

@kroggen kroggen commented Oct 7, 2024

Removes the CodeUrl field from the "contract" document.

The VerifiedToken field should contain the token symbol

No longer uses the SCAN_CONTRACT_VERIFIED (SCV). It must be replaced by a simpler version, no NFT based.

@kroggen kroggen force-pushed the contract-source-code-2 branch 2 times, most recently from f524f74 to 922f89b Compare October 7, 2024 20:52
@kroggen kroggen force-pushed the contract-source-code-2 branch from 922f89b to 3ee39ce Compare October 9, 2024 21:28
@kroggen
Copy link
Member Author

kroggen commented Oct 12, 2024

Here is the code for the contract to track source-code of old contracts: (replace SCV)

state.var {
  registry = state.map(),
  owner = state.value()
}

function set_code(address, source_code)
  assert(system.getSender() == owner:get(), "permission denied")
  registry[address] = source_code
end

function get_code(address)
  return registry[address]
end

function set_owner(address)
  assert(system.getSender() == owner:get(), "permission denied")
  owner:set(address)
end

function constructor()
  owner:set(system.getCreator())
end

abi.register(set_code, set_owner)
abi.register_view(get_code)

func ConvContractFromCall(txDoc *EsTx, contractAddress []byte, creator, sourceCode, deployArgs string) *EsContract {
byteCode, abi, err := CompileSourceCode(sourceCode)
if err != nil {
panic(err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it safe to invoke panic here? Does any caller catches the panic?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know. The idea is to make the app to close
What would be the alternative? Maybe retry?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neither do I. You know much more than me about indexer. If panic is propagated to top level of call stack, the process will be terminated. I don't know this is expected behavior or not of indexer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants