1.14.4 • Published 8 months ago

global-swap v1.14.4

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

Sample Hardhat Project

This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, and a script that deploys that contract.

Try running some of the following tasks:

npx hardhat help
npx hardhat test
REPORT_GAS=true npx hardhat test
npx hardhat node
npx hardhat run scripts/deploy.ts

// todo

function defineToken( address _token1, address _token2, uint rate1, uint rate2 ) public onlyRole(DEFAULT_ADMIN_ROLE) { tokenAddressidToken = _token1; idToken++;

    tokenAddress[idToken] = _token2;
    idToken++;

    _currencies[_token1];
    _currencies[_token2];

    _rate[_token1][_token2] = rate1;
    _rate[_token2][_token1] = rate2;
}

function getRate(address _from, address _to) public view returns (uint) {
    return _rate[_from][_to];
}

function swapUsdt(
    address _from,
    address _to,
    uint amount
) public view returns (uint) {
    uint unit = 1 * 10 ** 9;
    uint reatePerGnet = getRate(_from, _to);
    uint ratePerUnit = reatePerGnet / unit;
    uint gnetAmount = amount / ratePerUnit;
    return gnetAmount;
    // usdt.transferFrom(msg.sender, address(this), amount);
    // gnet.transfer(msg.sender, gnetAmount);
}

// function swapGnet(uint amount) public view returns (uint) {
//     uint formatAmount = amount * 10 ** 9;
//     uint unit = 1 * 10 ** 18;
//     uint usdtAmount = (formatAmount * unit) / ratePerUsdt;
//     return usdtAmount;
//     // gnet.transferFrom(msg.sender, address(this), amount);
//     // usdt.transfer(msg.sender, usdtAmount);
// }
1.14.0

8 months ago

1.14.4

8 months ago

1.13.0

9 months ago

1.10.3

1 year ago

1.12.0

1 year ago

1.10.2

1 year ago

1.9.0

1 year ago

1.8.0

1 year ago

1.7.0

1 year ago

1.6.0

1 year ago

1.11.0

1 year ago

1.10.1

1 year ago

1.10.0

1 year ago

1.5.0

1 year ago

1.4.0

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.2.0

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago