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

convert CurrentAnswerInterface to int256 #1280

Merged
merged 3 commits into from
May 29, 2019
Merged

Conversation

se3000
Copy link
Contributor

@se3000 se3000 commented May 29, 2019

No description provided.

@se3000 se3000 force-pushed the features/current-answer-int256 branch from 3f438ed to 89d809a Compare May 29, 2019 05:52
{
// solium-disable-next-line zeppelin/no-arithmetic-operations
int256 c = _a + _b; // signed integers are not supported by SafeMath
require(c >= _a, "SafeMath: addition overflow");
Copy link
Contributor

Choose a reason for hiding this comment

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

This condition should not hold, if _b is negative. I think it's necessary to enumerate the cases for the possible signs of _a and _b, or something similar to that.

There should probably be tests for correct behavior and halting in the four cases, too.

Copy link
Contributor

Choose a reason for hiding this comment

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

I suppose there are only two cases, actually: _b non-negative, and _b negative.

se3000 added 2 commits May 29, 2019 13:17
- will move to OpenZeppelin version once we are compatible with Solidity v0.5
@se3000 se3000 merged commit 811d456 into master May 29, 2019
@se3000 se3000 deleted the features/current-answer-int256 branch June 25, 2019 22:08
asoliman92 pushed a commit that referenced this pull request Aug 28, 2024
## Motivation

Currently all USDC token transfers occur using Burn/Mint with calls to
Circle's CCTP system for cross-chain transfers. Certain chains in CCIP
have non-canonical USDC deployed and want to integrate the ability to
use CCIP as a canonical bridge whereby canonical-USDC is locked on the
source-chain and then minted on the destination chain. Then at a later
date, when circle decides to add that chain to CCTP, the non-canonical
USDC will be converted into canonical by burning the locked-tokens on
the source-chain. To accomplish this, the token pool needs to be capable
of identifying when tokens should be burned/minted with CCTP, or if they
should use regular lock-release, and act accordingly.

## Solution

`USDCTokenPool.sol` was been modified into a new file to allow for two
different mechanisms to be used simultaneously. The primary mechanism,
which is opt-out, and the secondary-mechanism which is opt in. These
mechanisms are configured on a per-chain-selector basis, and must be
manually enabled. In this implementation CCTP is the primary mechanism,
and Lock/Release is the alternative mechanism.

There are two new files
1. `HybridLockReleaseUSDCTokenPool.sol`, The actual implementation of
the hybrid pool structure.
3. `USDCBridgeMigrator.sol`, which contains the logic necessary to
conform to [Circle's migration policy
guide](https://github.com/circlefin/stablecoin-evm/blob/master/doc/bridged_USDC_standard.md#transferring-the-roles-to-circle)
asoliman92 pushed a commit that referenced this pull request Aug 28, 2024
## Motivation

Currently all USDC token transfers occur using Burn/Mint with calls to
Circle's CCTP system for cross-chain transfers. Certain chains in CCIP
have non-canonical USDC deployed and want to integrate the ability to
use CCIP as a canonical bridge whereby canonical-USDC is locked on the
source-chain and then minted on the destination chain. Then at a later
date, when circle decides to add that chain to CCTP, the non-canonical
USDC will be converted into canonical by burning the locked-tokens on
the source-chain. To accomplish this, the token pool needs to be capable
of identifying when tokens should be burned/minted with CCTP, or if they
should use regular lock-release, and act accordingly.

## Solution

`USDCTokenPool.sol` was been modified into a new file to allow for two
different mechanisms to be used simultaneously. The primary mechanism,
which is opt-out, and the secondary-mechanism which is opt in. These
mechanisms are configured on a per-chain-selector basis, and must be
manually enabled. In this implementation CCTP is the primary mechanism,
and Lock/Release is the alternative mechanism.

There are two new files
1. `HybridLockReleaseUSDCTokenPool.sol`, The actual implementation of
the hybrid pool structure.
3. `USDCBridgeMigrator.sol`, which contains the logic necessary to
conform to [Circle's migration policy
guide](https://github.com/circlefin/stablecoin-evm/blob/master/doc/bridged_USDC_standard.md#transferring-the-roles-to-circle)
asoliman92 pushed a commit that referenced this pull request Aug 28, 2024
## Motivation

Currently all USDC token transfers occur using Burn/Mint with calls to
Circle's CCTP system for cross-chain transfers. Certain chains in CCIP
have non-canonical USDC deployed and want to integrate the ability to
use CCIP as a canonical bridge whereby canonical-USDC is locked on the
source-chain and then minted on the destination chain. Then at a later
date, when circle decides to add that chain to CCTP, the non-canonical
USDC will be converted into canonical by burning the locked-tokens on
the source-chain. To accomplish this, the token pool needs to be capable
of identifying when tokens should be burned/minted with CCTP, or if they
should use regular lock-release, and act accordingly.

## Solution

`USDCTokenPool.sol` was been modified into a new file to allow for two
different mechanisms to be used simultaneously. The primary mechanism,
which is opt-out, and the secondary-mechanism which is opt in. These
mechanisms are configured on a per-chain-selector basis, and must be
manually enabled. In this implementation CCTP is the primary mechanism,
and Lock/Release is the alternative mechanism.

There are two new files
1. `HybridLockReleaseUSDCTokenPool.sol`, The actual implementation of
the hybrid pool structure.
3. `USDCBridgeMigrator.sol`, which contains the logic necessary to
conform to [Circle's migration policy
guide](https://github.com/circlefin/stablecoin-evm/blob/master/doc/bridged_USDC_standard.md#transferring-the-roles-to-circle)
asoliman92 pushed a commit that referenced this pull request Aug 28, 2024
## Motivation

Currently all USDC token transfers occur using Burn/Mint with calls to
Circle's CCTP system for cross-chain transfers. Certain chains in CCIP
have non-canonical USDC deployed and want to integrate the ability to
use CCIP as a canonical bridge whereby canonical-USDC is locked on the
source-chain and then minted on the destination chain. Then at a later
date, when circle decides to add that chain to CCTP, the non-canonical
USDC will be converted into canonical by burning the locked-tokens on
the source-chain. To accomplish this, the token pool needs to be capable
of identifying when tokens should be burned/minted with CCTP, or if they
should use regular lock-release, and act accordingly.

## Solution

`USDCTokenPool.sol` was been modified into a new file to allow for two
different mechanisms to be used simultaneously. The primary mechanism,
which is opt-out, and the secondary-mechanism which is opt in. These
mechanisms are configured on a per-chain-selector basis, and must be
manually enabled. In this implementation CCTP is the primary mechanism,
and Lock/Release is the alternative mechanism.

There are two new files
1. `HybridLockReleaseUSDCTokenPool.sol`, The actual implementation of
the hybrid pool structure.
3. `USDCBridgeMigrator.sol`, which contains the logic necessary to
conform to [Circle's migration policy
guide](https://github.com/circlefin/stablecoin-evm/blob/master/doc/bridged_USDC_standard.md#transferring-the-roles-to-circle)
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.

2 participants