Git Product home page Git Product logo

curve-stablecoin's Introduction

Curve Stablecoin contracts

Install dependencies using poetry

Installing poetry and all dependencies for tests

pip install poetry
poetry install

Installing specific dependency groups (main/dev(tests)/ape(deploy))

poetry install --without dev,ape

Updating dependencies

poetry add vyper
poetry add "vyper>=0.3.7,<0.4"
poetry add --group dev "git+https://github.com/vyperlang/titanoboa.git@6ffcfa724023fb2b9f8ed02221c8bcbf4511712c"

Removing dependencies

poetry remove ape-alchemy --group ape

Environment for forked tests

Install env for forked tests

cd deploy_env
poetry install --sync
cd -

Put settings file (".env") into parent directory. Example defines all required parameters, mainly external web3 provider.

curve-stablecoin's People

Contributors

amfet42 avatar bout3fiddy avatar charles-cooper avatar macket avatar michwill avatar romanagureev avatar skellet0r avatar tomafrench avatar wc117 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

curve-stablecoin's Issues

any testnet deployment avaiable?

to understand the code as well as the white paper, it is better to interact it by hand.
However, i still not figure out how to deploy it.
so, is there any testnet deployment exists, so that i can play with?

✨EIP2612 support

I know permit2 exists, but this is cheaper for the user and negates the need for the user to approve the permit2 contract.

nonces: public(HashMap[address, uint256])

CHAIN_ID: public(uint256)

DOMAIN_SEPARATOR: public(bytes32)

DOMAIN_TYPE_HASH: constant(bytes32) = 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f

PERMIT_TYPE_HASH: constant(bytes32) = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9

@external
def initialize():
    
    # ...

    self.CHAIN_ID = chain.id

    self.DOMAIN_SEPARATOR = keccak256(
        concat(
            DOMAIN_TYPE_HASH, 
            keccak256(self.name), 
            keccak256("1"), 
            convert(chain.id, bytes32), 
            convert(self, bytes32)
        )
    )

@external
def permit(
    owner: address,
    spender: address,
    amount: uint256,
    deadline: uint256,
    v: uint8,
    r: bytes32,
    s: bytes32
) -> bool:

    assert owner != ZERO_ADDRESS
    assert block.timestamp <= deadline

    nonce: uint256 = self.nonces[owner]
    
    digest: bytes32 = keccak256(
        concat(
            b"\x19\x01",
            self.DOMAIN_SEPARATOR,
            keccak256(_abi_encode(PERMIT_TYPE_HASH, owner, spender, amount, nonce, deadline))
        )
    )

    recoveredAddress: address = ecrecover(digest, convert(v, uint256), convert(r, uint256), convert(s, uint256))
    assert recoveredAddress != ZERO_ADDRESS and recoveredAddress == owner, "INVALID_SIGNATURE"

    self.allowance[owner][spender] = amount
    self.nonces[owner] = nonce + 1

    log Approval(owner, spender, amount)
    
    return True

Glad to create a PR if this gets traction.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.