-
Notifications
You must be signed in to change notification settings - Fork 48
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
Emulator Feature: Bootstrap with default contracts #88
Conversation
hello @janezpodhostnik @psiemens @sideninja @turbolent :) tagging just in case you didn't see! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very good overall. Thank you for this!
I left some comments.
@mwufi Great effort so far, left some comments. Another general comment is don't forget to update docs with any new flags you add. |
Left a question. Also please make sure the CI tests are passing. By taking a quick look it might be you need to tidy the dependencies. |
Codecov Report
@@ Coverage Diff @@
## master #88 +/- ##
=======================================
Coverage 55.35% 55.35%
=======================================
Files 20 20
Lines 1738 1738
=======================================
Hits 962 962
Misses 672 672
Partials 104 104
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
Update for posterity! tl;dr - the logic with the keys might be refactored in the future! For now, it seems OK.
i think @sideninja is moderately happy with this... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, great work 🚀
@sideninja i |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @mwufi!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Hey @psiemens can you quickly review onflow/fusd#2? Made a tiny change to merge before adding it to this one! |
I will take a look at this @mwufi |
@mwufi onflow/fusd#2 Approved and merged |
server/contracts.go
Outdated
return []byte(code) | ||
} | ||
|
||
func deployContract(name string, contract []byte, b *emulator.Blockchain) (flow.Address, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the intention to have contracts deployed to different accounts, else you can deploy all at once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, interesting!! How do you deploy all at once?
Haha I thought it was all right to have different accounts for each one, but they could also go ito the same account... the bigger thing will probably be.. how do you control the accounts once you've deployed the contracts?
- actually it might be a good idea to make them all deploy from the service acct, since that's what you have the keys for, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think that it would be better to deploy on the service account not just because of the keys but also there are for sure a lot of tests/projects, unfortunately, depending on the sequence of addresses used for testing so if you will "use" those addresses to do these deployments we might break something for them. You can deploy them using a single transaction as contracts can be passed as an array, see here: https://pkg.go.dev/github.com/onflow/flow-go-sdk/templates#CreateAccount
So maybe better change this and then we should be all good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
Awesome, thanks @sideninja !!! (other team members, feel free to merge, since i don't have merge permissions!) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great improvement. I think this is it 🎉
wait, actually i made a mistake!! with the second way, it didn't actually submit the transactions, just created them :( so now i'm figuring out how to run the transactions !! alternatively, would it be a good idea to create one (1) new account for the contracts? instead of deploying to the service acct? |
I planned to test this tomorrow, so will keep you updated. We would only merge this after the Flip fest so no worries. |
{"ExampleNFT", serviceAcct, "✨ NFT contract"}, | ||
{"NFTStorefront", serviceAcct, "✨ NFT contract"}, | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use emulator instance SendTransaction
function here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah you are right sorry, no method like that on the blockchain. Maybe anyhow extract to some helper.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Closes: FLIP Fest issue 27 onflow/flip-fest#27
Description
The emulator should be able to deploy contracts when it starts up. We add the following ones:
To get this to work, we do two things:
Notes:
flow-nft
reponft-marketplace
repo so that it's easier to pull fromWe also include defaults for sig&hash algo (in
start.go
). (Does this address #85 ?)Tests
GO111MODULE=on go run ./cmd/emulator --contracts
GO111MODULE=on go run ./cmd/emulator --contracts --service-priv-key 92ecc6ca2a30b1da782dc6ca6a6da73ad3d9214adb041b5185ca5196bd46e3c7
If you run with a custom private key, it reflects that:
For contributor use:
master
branchFiles changed
in the Github PR explorer