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: support for intents #5588

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Conversation

fernandomg
Copy link

@fernandomg fernandomg commented Feb 28, 2025

Description

This PR adds support for the Hyperlane7683 intents.

Four new adapters were added to support intents:

  • EvmIntentTokenAdapter (instance returned by getAdapter);
  • EvmIntentNativeTokenAdapter (instance returned by getAdapter);
  • EvmIntentMultiChainAdapter (instance returned by getHypAdapter);
  • EvmIntentNativeMultiChainAdapter (instance returned by getHypAdapter);

Also, there was a dependency addition:

  • @bootnodedev/intents-framework-core to provide Hyperlane7683 factory;

Latetly, a change that may not affect the interfaces as is an optional value, but a new parameter was added:

  • fillDeadline parameter used by intents, whose default value is 1 day in seconds.

Copy link

changeset-bot bot commented Feb 28, 2025

⚠️ No Changeset found

Latest commit: 3fc778f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@@ -5,6 +5,7 @@
"dependencies": {
"@arbitrum/sdk": "^4.0.0",
"@aws-sdk/client-s3": "^3.577.0",
"@bootnodedev/intents-framework-core": "^0.1.0",
Copy link
Author

Choose a reason for hiding this comment

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

we need this to interact with the Hyperlane7683 contracts

@@ -175,6 +196,7 @@ export class Token implements IToken {
getHypAdapter(
multiProvider: MultiProtocolProvider<{ mailbox?: Address }>,
destination?: ChainName,
fillDeadline: number = Math.floor(Date.now() / 1000) + 60 * 60 * 24,
Copy link
Author

Choose a reason for hiding this comment

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

fillDeadline is an intent-specific value that can only be accessed if it's passed via parameters at runtime.

It has a default value to 1 day (in seconds) if it's not defined in the request.

Comment on lines +65 to +66
EvmIntent: ProtocolType.Ethereum,
EvmIntentNative: ProtocolType.Ethereum,
Copy link
Author

Choose a reason for hiding this comment

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

EmvIntent and EvmIntentNative are the standars that will identify the intents

@@ -67,7 +67,7 @@ describe('TokenDeployer', async () => {
await deployer.deploy(config);
});

for (const type of [TokenType.collateral, TokenType.synthetic]) {
for (const type of [TokenType.collateral, TokenType.synthetic] as const) {
Copy link
Author

Choose a reason for hiding this comment

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

these as const were a contribution to avoid TS complaining about types.

Comment on lines +107 to +126
if (
token1.standard === TokenStandard.EvmIntent ||
token1.standard === TokenStandard.EvmIntentNative
) {
if (
t.standard === TokenStandard.EvmIntent ||
t.standard === TokenStandard.EvmIntentNative
) {
if (t.standard === TokenStandard.EvmIntent) {
return t.collateralAddressOrDenom === addressOrDenom;
}
if (t.standard === TokenStandard.EvmIntentNative) {
return true;
}
}
return false;
} else {
return t.addressOrDenom === addressOrDenom;
}
});
Copy link
Author

Choose a reason for hiding this comment

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

properly finding the connections among intent-based tokens

Comment on lines +318 to +321
assert(
this.collateralAddressOrDenom,
'collateralAddressOrDenom required for EvmIntent tokens',
);
Copy link
Author

Choose a reason for hiding this comment

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

addressOrDenom hosts the address for the Hyperlane7683 instance (router), and collateralAddressOrDenom will be the ERC20 token address. That's why it's required when dealing with intents.

Added:
 - `EvmIntentTokenAdapter` (instance returned by `getAdapter`);
 - `EvmIntentNativeTokenAdapter` (instance returned by `getAdapter`);
 - `EvmIntentMultiChainAdapter` (instance returned by `getHypAdapter`);
 - `EvmIntentNativeMultiChainAdapter` (instance returned by `getHypAdapter`);
 - `@bootnodedev/intents-framework-core` to provide `Hyperlane7683` factory;
 - `fillDeadline` parameter used by intents, whose default value is 1 day in seconds.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

1 participant