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

feat: Outpost Factory #7

Merged
merged 88 commits into from
Oct 10, 2024
Merged

feat: Outpost Factory #7

merged 88 commits into from
Oct 10, 2024

Conversation

BiPhan4
Copy link
Collaborator

@BiPhan4 BiPhan4 commented Jun 19, 2024

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.

@BiPhan4
Copy link
Collaborator Author

BiPhan4 commented Jun 20, 2024

@karnthis Kindly provide feedback and request clarity and or changes for jackal.js integration.

Copy link
Member

@karnthis karnthis left a comment

Choose a reason for hiding this comment

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

LGTM

@karnthis
Copy link
Member

waiting on jjs updates before merging

@BiPhan4
Copy link
Collaborator Author

BiPhan4 commented Jul 25, 2024

The outpost's ts API is inside:

./ts

The factory's ts API is inside:

./cross-contract/contracts/outpost-factory/ts

@BiPhan4
Copy link
Collaborator Author

BiPhan4 commented Sep 28, 2024

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.

@BiPhan4
Copy link
Collaborator Author

BiPhan4 commented Oct 8, 2024

Update:

code IDs:

{ storage_outpost: 688, outpost_factory: 689 }

factory address:

archway1qrr93nv55mfhdhh2y3xmvppz7f5vcutjtk2pn8l9yve9gj3ktw9sp8spex

Copy link
Member

@TheMarstonConnell TheMarstonConnell left a 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

@BiPhan4 BiPhan4 merged commit 47b7fe1 into master Oct 10, 2024
0 of 6 checks passed
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.

3 participants