-
Notifications
You must be signed in to change notification settings - Fork 444
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
base: main
Are you sure you want to change the base?
Conversation
|
@@ -5,6 +5,7 @@ | |||
"dependencies": { | |||
"@arbitrum/sdk": "^4.0.0", | |||
"@aws-sdk/client-s3": "^3.577.0", | |||
"@bootnodedev/intents-framework-core": "^0.1.0", |
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.
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, |
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.
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.
EvmIntent: ProtocolType.Ethereum, | ||
EvmIntentNative: ProtocolType.Ethereum, |
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.
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) { |
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.
these as const
were a contribution to avoid TS complaining about types.
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; | ||
} | ||
}); |
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.
properly finding the connections among intent-based tokens
assert( | ||
this.collateralAddressOrDenom, | ||
'collateralAddressOrDenom required for EvmIntent tokens', | ||
); |
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.
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.
Description
This PR adds support for the
Hyperlane7683
intents.Four new adapters were added to support intents:
EvmIntentTokenAdapter
(instance returned bygetAdapter
);EvmIntentNativeTokenAdapter
(instance returned bygetAdapter
);EvmIntentMultiChainAdapter
(instance returned bygetHypAdapter
);EvmIntentNativeMultiChainAdapter
(instance returned bygetHypAdapter
);Also, there was a dependency addition:
@bootnodedev/intents-framework-core
to provideHyperlane7683
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.