-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: Outpost Factory #7
Conversation
merge inter-contract to dev
@karnthis Kindly provide feedback and request clarity and or changes for jackal.js integration. |
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
This reverts commit 776a456.
waiting on jjs updates before merging |
The outpost's ts API is inside: ./ts The factory's ts API is inside: ./cross-contract/contracts/outpost-factory/ts |
IMPORTANT: We must have a discussion about setting the admin of the factory, as well as the admin of all the minted outposts for migration purposes. |
Update: code IDs: { storage_outpost: 688, outpost_factory: 689 } factory address: archway1qrr93nv55mfhdhh2y3xmvppz7f5vcutjtk2pn8l9yve9gj3ktw9sp8spex |
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.
VERY GOOD I LOVE IT WAHOOOO
We introduce a factory contract that can 'mint' outposts and immediately map the user's address to their minted outpost address. This is done via callback.
A complete demo of using the factory can be found here:
https://github.com/BiPhan4/outpost-client-demo/blob/main/scripts/create_outpost.ts
Client developers need not worry about the callback mechanism, because it happens automatically when the outpost is created. Querying for the user_address<>outpost_address mapping is also shown in the above demo.
A Readme on the needed tx and query can be found here:
https://github.com/JackalLabs/storage-outpost/tree/inter-contract/cross-contract/contracts/outpost-factory
Archway Testnet
The outpost and factory wasm modules--as at this PR--have been deployed:
{ storage_outpost: 2980, outpost_factory: 2981 }
The factory contract has been instantiated with address:
archway1fdqdk2ck3hfzhx03qrx5arkhzz25qkz9x69utrmh2vxy85ur4f9spg5fcr
Instantiating Outpost Without Factory
Around line 130 of outpost-client-demo/scripts/create_outpost.ts, we show instantiating the storage-outpost without using the factory. There are two new optional fields: owner, callback. The callback can be ignored but the owner should be set.
This is not a breaking change. In any case, our aim is to not instantiate the outpost directly, and only use the factory.
Success or Failure
The outpost creation as well as the callback happens in one Tx. The CosmWasm framework guarantees that this is atomic and will succeed or fail--i.e., if one of the msgs fails, the entire tx aborts.
If successful, the created outpost's address can be retrieved from the wasm event, or queried for. Check out the below test for a complete e2e demonstration which includes parsing the wasm event, and all error scenarios.
https://github.com/JackalLabs/storage-outpost/blob/dev/e2e/interchaintest/outpost_factory_test.go
The testing command:
go test -v . -run TestWithFactoryTestSuite -testify.m TestFactoryCreateOutpost -timeout 12h
Which can be found in e2e/interchaintest/Readme.md
Currently, the user is automatically set as admin of their created outpost--also shown in the above demo.
Migrations
All files related to migrations and under the migrations/ directory is WIP and can be ignored. They are not coupled with the outpost or the factory.