Skip to content

Conversation

@chechu
Copy link
Contributor

@chechu chechu commented Sep 10, 2025

This PR introduces NTG (NativeTokenGateway) for Core pool in bnb chain . NativeTokenGateway contract facilitates interactions with a vToken market for native tokens.

This NativeTokenGateway is compatible with Isolated Pools. It's not
compatible with the BNB Chain Core pool.

Source: https://github.com/VenusProtocol/isolated-pools/blob/58b76f81f15c61fc441bd1c5b2831509ac943288/contracts/Gateway/NativeTokenGateway.sol
Check the error codes returned by the VToke calls
const { deployments, getNamedAccounts } = hre;
const { deploy } = deployments;
const { deployer } = await getNamedAccounts();
const NormalTimelock = "0xce10739590001705F7FF231611ba4A48B2820327"; // BSC Testnet Normal Timelock
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This must be recovered automatically, not hardcoded, depending on the selected network. We can read it from the npm governance package

Copy link
Contributor

Choose a reason for hiding this comment

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

}

const VWNativeInfo: { [key: string]: VTokenConfig[] } = {
bsctestnet: [
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would also add (not right now, but ideally before merging the PR) the configurations for the NTG of the Isolated Pools, on the rest of the networks. I would also copy/add the deployment files of those NTG contracts

const VWNativeInfo: { [key: string]: VTokenConfig[] } = {
bsctestnet: [
{
name: "vWBNB",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
name: "vWBNB",
name: "vWBNB_Core",

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would add a number prefix to this deployment script. We won't follow a sequence of execution in this project, but I think it will help to clearly identify the files

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would also consider the original fork tests in the IL repo, to check the NTG works as expected with IL markets

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think we should mix tests and no-tests contracts in the same folder. Moreover, can we replace these imports with any configuration in hardhat?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think that we can replace Solidity import statements with Hardhat configuration, as it cannot substitute for actual Solidity imports in the source files.

"chainId": "97",
"addresses": {}
"addresses": {
"NativeTokenGateway_vWBNB": "0xF34AAfc540Adc827A84736553BD29DE87a117558"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should it be renamed to NativeTokenGateway_vWBNB_Core?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't see the dependency. It would be only to rename the deployment, not affecting the deployed code

@github-actions
Copy link

Code Coverage

Package Line Rate Branch Rate Health
Gateway 98% 66%
Gateway.Interfaces 100% 100%
Summary 98% (64 / 65) 66% (25 / 38)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we don't need this file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we need two deployment files? Cannot we use only one (taking into account that there will be only on NativeTokenGateway.sol file)

"chainId": "97",
"addresses": {}
"addresses": {
"NativeTokenGateway_vWBNB": "0xF34AAfc540Adc827A84736553BD29DE87a117558"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't see the dependency. It would be only to rename the deployment, not affecting the deployed code

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