cryptoexchange

package module
v0.0.0-...-b1201a1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

README

Crypto-Exchange

Crypto-Exchange is a decentralized cryptocurrency exchange (DEX) built using modern technologies. It utilizes Golang for backend services, Solidity for smart contracts, and JavaScript for tooling. The project leverages cutting-edge blockchain developer tools, such as OpenZeppelin, Hardhat, and Ganache, to create a secure and scalable decentralized exchange platform.

Deployement Example

status	0x1 Transaction mined and execution succeed
transaction hash	0x0dff50888b1e55e22bf392d24240cc3f24257e322a56750e1b71071f91dade0d
block hash	0x92b396eaf1475db16f2fd63d9b4fe6f48d3a1f9f9f25a3db00b40ce99d494778
block number	12
contract address	0xDA0bab807633f07f013f94DD0E6A4F96F8742B53
from	0x5B38Da6a701c568545dCfcB03FcB875f56beddC4
to	ExchangeTest.(constructor)
gas	4460803 gas
transaction cost	3878959 gas 
execution cost	3556743 gas 
input	0x608...a0033
output	0x608060405260043610610054575f3560e01c8063342f99b6146100585780634cf16ba2146100625780636331e7d4146100785780637ce3e82e1461008e578063a3c560e5146100a4578063d36a1da3146100ba575b5f80fd5b6100606100c4565b005b34801561006d575f80fd5b5061007661025b565b005b348015610083575f80fd5b5061008c61054b565b005b348015610099575f80fd5b506100a26107fc565b005b3480156100af575f80fd5b506100b8610927565b005b6100c2610ad4565b005b5f68056bc75e2d6310000090505f67016345785d8a000090505f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632d296bf182846040518363ffffffff1660e01b81526004016101369190610d67565b60206040518083038185885af1158015610152573d5f803e3d5ffd5b50505050506040513d601f19601f820116820180604052508101906101779190610db9565b505f60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016101d39190610e23565b602060405180830381865afa1580156101ee573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102129190610e66565b9050828114610256576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161024d90610eeb565b60405180910390fd5b505050565b5f60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a082315f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff1660e01b81526004016102d59190610e23565b602060405180830381865afa1580156102f0573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103149190610e66565b905073d7acd2a9fd159e69bb102a1ca21c9a3e3a5f771b63abcd7960826969e10de76676d08000006040518363ffffffff1660e01b8152600401610359929190610fda565b602060405180830381865af4158015610374573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103989190610db9565b505f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166393aefa766040518163ffffffff1660e01b81526004015f604051808303815f87803b1580156103fd575f80fd5b505af115801561040f573d5f803e3d5ffd5b505050505f60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a082315f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff1660e01b815260040161048d9190610e23565b602060405180830381865afa1580156104a8573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104cc9190610e66565b905073d7acd2a9fd159e69bb102a1ca21c9a3e3a5f771b63abcd7960825f6040518363ffffffff1660e01b81526004016105079291906110bd565b602060405180830381865af4158015610522573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105469190610db9565b505050565b3060025f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061012360035f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061045660045f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060055460025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660405161064090610d35565b61064b92919061118b565b604051809103905ff080158015610664573d5f803e3d5ffd5b5060015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040516106d290610d42565b6106dc9190610e23565b604051809103905ff0801580156106f5573d5f803e3d5ffd5b505f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff166969e10de76676d08000006040518363ffffffff1660e01b81526004016107b99291906111e7565b6020604051808303815f875af11580156107d5573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107f99190610db9565b50565b5f808054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166369ea1771681b1ae4d6e2ef5000006040518263ffffffff1660e01b815260040161085e9190611247565b6020604051808303815f875af192505050801561089957506040513d601f19601f820116820180604052508101906108969190610db9565b60015b6108a5575f90506108ab565b50600190505b73d7acd2a9fd159e69bb102a1ca21c9a3e3a5f771b63767392b3825f6040518363ffffffff1660e01b81526004016108e49291906112df565b602060405180830381865af41580156108ff573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109239190610db9565b5050565b5f68410d586a20a4c0000090505f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166369ea1771826040518263ffffffff1660e01b815260040161098c9190610d67565b6020604051808303815f875af11580156109a8573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109cc9190610db9565b5073d7acd2a9fd159e69bb102a1ca21c9a3e3a5f771b63abcd79605f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632c4e722e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a4f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a739190610e66565b836040518363ffffffff1660e01b8152600401610a91929190611389565b602060405180830381865af4158015610aac573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ad09190610db9565b5050565b5f670de0b6b3a764000090505f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc8290811502906040515f60405180830381858888f19350505050158015610b42573d5f803e3d5ffd5b505f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1631905073d7acd2a9fd159e69bb102a1ca21c9a3e3a5f771b63abcd796082846040518363ffffffff1660e01b8152600401610bb792919061140d565b602060405180830381865af4158015610bd2573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610bf69190610db9565b505f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c311d049836040518263ffffffff1660e01b8152600401610c4f9190610d67565b5f604051808303815f87803b158015610c66575f80fd5b505af1158015610c78573d5f803e3d5ffd5b505050505f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1631905073d7acd2a9fd159e69bb102a1ca21c9a3e3a5f771b63abcd7960825f6040518363ffffffff1660e01b8152600401610cf09291906114b7565b602060405180830381865af4158015610d0b573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d2f9190610db9565b50505050565b611854806114f283390190565b61170c80612d4683390190565b5f819050919050565b610d6181610d4f565b82525050565b5f602082019050610d7a5f830184610d58565b92915050565b5f80fd5b5f8115159050919050565b610d9881610d84565b8114610da2575f80fd5b50565b5f81519050610db381610d8f565b92915050565b5f60208284031215610dce57610dcd610d80565b5b5f610ddb84828501610da5565b91505092915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610e0d82610de4565b9050919050565b610e1d81610e03565b82525050565b5f602082019050610e365f830184610e14565b92915050565b610e4581610d4f565b8114610e4f575f80fd5b50565b5f81519050610e6081610e3c565b92915050565b5f60208284031215610e7b57610e7a610d80565b5b5f610e8884828501610e52565b91505092915050565b5f82825260208201905092915050565b7f53686f756c64206861766520626f756768742031303020746f6b656e730000005f82015250565b5f610ed5601d83610e91565b9150610ee082610ea1565b602082019050919050565b5f6020820190508181035f830152610f0281610ec9565b9050919050565b610f1281610d4f565b82525050565b5f819050919050565b5f819050919050565b5f610f44610f3f610f3a84610f18565b610f21565b610d4f565b9050919050565b610f5481610f2a565b82525050565b5f82825260208201905092915050565b7f436f6e74726163742073686f756c6420686f6c64203530302c30303020746f6b5f8201527f656e730000000000000000000000000000000000000000000000000000000000602082015250565b5f610fc4602383610f5a565b9150610fcf82610f6a565b604082019050919050565b5f606082019050610fed5f830185610f09565b610ffa6020830184610f4b565b818103604083015261100b81610fb8565b90509392505050565b5f819050919050565b5f61103761103261102d84611014565b610f21565b610d4f565b9050919050565b6110478161101d565b82525050565b7f436f6e74726163742073686f756c6420686f6c64203020746f6b656e732061665f8201527f74657220656d657267656e6379207769746864726177616c0000000000000000602082015250565b5f6110a7603883610f5a565b91506110b28261104d565b604082019050919050565b5f6060820190506110d05f830185610f09565b6110dd602083018461103e565b81810360408301526110ee8161109b565b90509392505050565b7f446576436f696e000000000000000000000000000000000000000000000000005f82015250565b5f61112b600783610e91565b9150611136826110f7565b602082019050919050565b7f44564300000000000000000000000000000000000000000000000000000000005f82015250565b5f611175600383610e91565b915061118082611141565b602082019050919050565b5f6080820190508181035f8301526111a28161111f565b905081810360208301526111b581611169565b90506111c46040830185610d58565b6111d16060830184610e14565b9392505050565b6111e181610f2a565b82525050565b5f6040820190506111fa5f830185610e14565b61120760208301846111d8565b9392505050565b5f819050919050565b5f61123161122c6112278461120e565b610f21565b610d4f565b9050919050565b61124181611217565b82525050565b5f60208201905061125a5f830184611238565b92915050565b61126981610d84565b82525050565b7f4e6f6e2d6f776e65722073686f756c64206e6f742062652061626c6520746f205f8201527f7570646174652074686520726174650000000000000000000000000000000000602082015250565b5f6112c9602f83610f5a565b91506112d48261126f565b604082019050919050565b5f6060820190506112f25f830185611260565b6112ff6020830184611260565b8181036040830152611310816112bd565b90509392505050565b7f526174652073686f756c64206265207570646174656420746f203132303020745f8201527f6f6b656e73207065722031204554480000000000000000000000000000000000602082015250565b5f611373602f83610f5a565b915061137e82611319565b604082019050919050565b5f60608201905061139c5f830185610f09565b6113a96020830184610f09565b81810360408301526113ba81611367565b90509392505050565b7f436f6e74726163742073686f756c6420686176652031204554480000000000005f82015250565b5f6113f7601a83610f5a565b9150611402826113c3565b602082019050919050565b5f6060820190506114205f830185610f09565b61142d6020830184610f09565b818103604083015261143e816113eb565b90509392505050565b7f436f6e74726163742062616c616e63652073686f756c642062652030206166745f8201527f6572207769746864726177616c00000000000000000000000000000000000000602082015250565b5f6114a1602d83610f5a565b91506114ac82611447565b604082019050919050565b5f6060820190506114ca5f830185610f09565b6114d7602083018461103e565b81810360408301526114e881611495565b9050939250505056fe608060405234801561000f575f80fd5b50604051611854380380611854833981810160405281019061003191906104e6565b838381600390816100429190610786565b5080600490816100529190610786565b505050610065818361006e60201b60201c565b5050505061093a565b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036100de575f6040517fec442f050000000000000000000000000000000000000000000000000000000081526004016100d59190610864565b60405180910390fd5b6100ef5f83836100f360201b60201c565b5050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610143578060025f82825461013791906108aa565b92505081905550610211565b5f805f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050818110156101cc578381836040517fe450d38c0000000000000000000000000000000000000000000000000000000081526004016101c3939291906108ec565b60405180910390fd5b8181035f808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550505b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610258578060025f82825403925050819055506102a2565b805f808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516102ff9190610921565b60405180910390a3505050565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61036b82610325565b810181811067ffffffffffffffff8211171561038a57610389610335565b5b80604052505050565b5f61039c61030c565b90506103a88282610362565b919050565b5f67ffffffffffffffff8211156103c7576103c6610335565b5b6103d082610325565b9050602081019050919050565b8281835e5f83830152505050565b5f6103fd6103f8846103ad565b610393565b90508281526020810184848401111561041957610418610321565b5b6104248482856103dd565b509392505050565b5f82601f8301126104405761043f61031d565b5b81516104508482602086016103eb565b91505092915050565b5f819050919050565b61046b81610459565b8114610475575f80fd5b50565b5f8151905061048681610462565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6104b58261048c565b9050919050565b6104c5816104ab565b81146104cf575f80fd5b50565b5f815190506104e0816104bc565b92915050565b5f805f80608085870312156104fe576104fd610315565b5b5f85015167ffffffffffffffff81111561051b5761051a610319565b5b6105278782880161042c565b945050602085015167ffffffffffffffff81111561054857610547610319565b5b6105548782880161042c565b935050604061056587828801610478565b9250506060610576878288016104d2565b91505092959194509250565b5f81519050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806105d057607f821691505b6020821081036105e3576105e261058c565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f600883026106457fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8261060a565b61064f868361060a565b95508019841693508086168417925050509392505050565b5f819050919050565b5f61068a61068561068084610459565b610667565b610459565b9050919050565b5f819050919050565b6106a383610670565b6106b76106af82610691565b848454610616565b825550505050565b5f90565b6106cb6106bf565b6106d681848461069a565b505050565b5b818110156106f9576106ee5f826106c3565b6001810190506106dc565b5050565b601f82111561073e5761070f816105e9565b610718846105fb565b81016020851015610727578190505b61073b610733856105fb565b8301826106db565b50505b505050565b5f82821c905092915050565b5f61075e5f1984600802610743565b1980831691505092915050565b5f610776838361074f565b9150826002028217905092915050565b61078f82610582565b67ffffffffffffffff8111156107a8576107a7610335565b5b6107b282546105b9565b6107bd8282856106fd565b5f60209050601f8311600181146107ee575f84156107dc578287015190505b6107e6858261076b565b86555061084d565b601f1984166107fc866105e9565b5f5b82811015610823578489015182556001820191506020850194506020810190506107fe565b86831015610840578489015161083c601f89168261074f565b8355505b6001600288020188555050505b505050505050565b61085e816104ab565b82525050565b5f6020820190506108775f830184610855565b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6108b482610459565b91506108bf83610459565b92508282019050808211156108d7576108d661087d565b5b92915050565b6108e681610459565b82525050565b5f6060820190506108ff5f830186610855565b61090c60208301856108dd565b61091960408301846108dd565b949350505050565b5f6020820190506109345f8301846108dd565b92915050565b610f0d806109475f395ff3fe608060405234801561000f575f80fd5b50600436106100a7575f3560e01c806342966c681161006f57806342966c681461016557806370a082311461018157806379cc6790146101b157806395d89b41146101cd578063a9059cbb146101eb578063dd62ed3e1461021b576100a7565b806306fdde03146100ab578063095ea7b3146100c957806318160ddd146100f957806323b872dd14610117578063313ce56714610147575b5f80fd5b6100b361024b565b6040516100c09190610b5b565b60405180910390f35b6100e360048036038101906100de9190610c0c565b6102db565b6040516100f09190610c64565b60405180910390f35b6101016102fd565b60405161010e9190610c8c565b60405180910390f35b610131600480360381019061012c9190610ca5565b610306565b60405161013e9190610c64565b60405180910390f35b61014f610334565b60405161015c9190610d10565b60405180910390f35b61017f600480360381019061017a9190610d29565b61033c565b005b61019b60048036038101906101969190610d54565b610350565b6040516101a89190610c8c565b60405180910390f35b6101cb60048036038101906101c69190610c0c565b610395565b005b6101d56103b5565b6040516101e29190610b5b565b60405180910390f35b61020560048036038101906102009190610c0c565b610445565b6040516102129190610c64565b60405180910390f35b61023560048036038101906102309190610d7f565b610467565b6040516102429190610c8c565b60405180910390f35b60606003805461025a90610dea565b80601f016020809104026020016040519081016040528092919081815260200182805461028690610dea565b80156102d15780601f106102a8576101008083540402835291602001916102d1565b820191905f5260205f20905b8154815290600101906020018083116102b457829003601f168201915b5050505050905090565b5f806102e56104e9565b90506102f28185856104f0565b600191505092915050565b5f600254905090565b5f806103106104e9565b905061031d858285610502565b610328858585610594565b60019150509392505050565b5f6012905090565b61034d6103476104e9565b82610684565b50565b5f805f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050919050565b6103a7826103a16104e9565b83610502565b6103b18282610684565b5050565b6060600480546103c490610dea565b80601f01602080910402602001604051908101604052809291908181526020018280546103f090610dea565b801561043b5780601f106104125761010080835404028352916020019161043b565b820191905f5260205f20905b81548152906001019060200180831161041e57829003601f168201915b5050505050905090565b5f8061044f6104e9565b905061045c818585610594565b600191505092915050565b5f60015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905092915050565b5f33905090565b6104fd8383836001610703565b505050565b5f61050d8484610467565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811461058e578181101561057f578281836040517ffb8f41b200000000000000000000000000000000000000000000000000000000815260040161057693929190610e29565b60405180910390fd5b61058d84848484035f610703565b5b50505050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610604575f6040517f96c6fd1e0000000000000000000000000000000000000000000000000000000081526004016105fb9190610e5e565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610674575f6040517fec442f0500000000000000000000000000000000000000000000000000000000815260040161066b9190610e5e565b60405180910390fd5b61067f8383836108d2565b505050565b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036106f4575f6040517f96c6fd1e0000000000000000000000000000000000000000000000000000000081526004016106eb9190610e5e565b60405180910390fd5b6106ff825f836108d2565b5050565b5f73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603610773575f6040517fe602df0500000000000000000000000000000000000000000000000000000000815260040161076a9190610e5e565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036107e3575f6040517f94280d620000000000000000000000000000000000000000000000000000000081526004016107da9190610e5e565b60405180910390fd5b8160015f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f208190555080156108cc578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516108c39190610c8c565b60405180910390a35b50505050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610922578060025f8282546109169190610ea4565b925050819055506109f0565b5f805f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050818110156109ab578381836040517fe450d38c0000000000000000000000000000000000000000000000000000000081526004016109a293929190610e29565b60405180910390fd5b8181035f808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550505b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610a37578060025f8282540392505081905550610a81565b805f808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610ade9190610c8c565b60405180910390a3505050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f610b2d82610aeb565b610b378185610af5565b9350610b47818560208601610b05565b610b5081610b13565b840191505092915050565b5f6020820190508181035f830152610b738184610b23565b905092915050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610ba882610b7f565b9050919050565b610bb881610b9e565b8114610bc2575f80fd5b50565b5f81359050610bd381610baf565b92915050565b5f819050919050565b610beb81610bd9565b8114610bf5575f80fd5b50565b5f81359050610c0681610be2565b92915050565b5f8060408385031215610c2257610c21610b7b565b5b5f610c2f85828601610bc5565b9250506020610c4085828601610bf8565b9150509250929050565b5f8115159050919050565b610c5e81610c4a565b82525050565b5f602082019050610c775f830184610c55565b92915050565b610c8681610bd9565b82525050565b5f602082019050610c9f5f830184610c7d565b92915050565b5f805f60608486031215610cbc57610cbb610b7b565b5b5f610cc986828701610bc5565b9350506020610cda86828701610bc5565b9250506040610ceb86828701610bf8565b9150509250925092565b5f60ff82169050919050565b610d0a81610cf5565b82525050565b5f602082019050610d235f830184610d01565b92915050565b5f60208284031215610d3e57610d3d610b7b565b5b5f610d4b84828501610bf8565b91505092915050565b5f60208284031215610d6957610d68610b7b565b5b5f610d7684828501610bc5565b91505092915050565b5f8060408385031215610d9557610d94610b7b565b5b5f610da285828601610bc5565b9250506020610db385828601610bc5565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f6002820490506001821680610e0157607f821691505b602082108103610e1457610e13610dbd565b5b50919050565b610e2381610b9e565b82525050565b5f606082019050610e3c5f830186610e1a565b610e496020830185610c7d565b610e566040830184610c7d565b949350505050565b5f602082019050610e715f830184610e1a565b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f610eae82610bd9565b9150610eb983610bd9565b9250828201905080821115610ed157610ed0610e77565b5b9291505056fea2646970667358221220a4940d81ce978ce0a854d20e80dc669277cae841ce58c9275fcc3328bccba29064736f6c634300081a0033608060405234801561000f575f80fd5b5060405161170c38038061170c83398181016040528101906100319190610199565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361009f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100969061021e565b60405180910390fd5b8060035f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550335f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555042600181905550683635c9adc5dea000006002819055505061023c565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6101688261013f565b9050919050565b6101788161015e565b8114610182575f80fd5b50565b5f815190506101938161016f565b92915050565b5f602082840312156101ae576101ad61013b565b5b5f6101bb84828501610185565b91505092915050565b5f82825260208201905092915050565b7f496e76616c696420746f6b656e20636f6e7472616374206164647265737300005f82015250565b5f610208601e836101c4565b9150610213826101d4565b602082019050919050565b5f6020820190508181035f830152610235816101fc565b9050919050565b6114c3806102495f395ff3fe608060405260043610610094575f3560e01c80638da5cb5b116100585780638da5cb5b1461019b57806393aefa76146101c5578063c311d049146101db578063d8270dce14610203578063fc0c546a1461022d5761009b565b80632397e4d71461009f5780632c4e722e146100db5780632d296bf1146101055780633bd099d31461013557806369ea17711461015f5761009b565b3661009b57005b5f80fd5b3480156100aa575f80fd5b506100c560048036038101906100c09190610de3565b610257565b6040516100d29190610e28565b60405180910390f35b3480156100e6575f80fd5b506100ef610581565b6040516100fc9190610e50565b60405180910390f35b61011f600480360381019061011a9190610de3565b610587565b60405161012c9190610e28565b60405180910390f35b348015610140575f80fd5b506101496108d2565b6040516101569190610e50565b60405180910390f35b34801561016a575f80fd5b5061018560048036038101906101809190610de3565b6108df565b6040516101929190610e28565b60405180910390f35b3480156101a6575f80fd5b506101af610a01565b6040516101bc9190610ea8565b60405180910390f35b3480156101d0575f80fd5b506101d9610a24565b005b3480156101e6575f80fd5b5061020160048036038101906101fc9190610de3565b610c0c565b005b34801561020e575f80fd5b50610217610d42565b6040516102249190610e50565b60405180910390f35b348015610238575f80fd5b50610241610d48565b60405161024e9190610f1c565b60405180910390f35b5f8061028860025461027a670de0b6b3a764000086610d6d90919063ffffffff16565b610d8290919063ffffffff16565b9050804710156102cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102c490610f8f565b60405180910390fd5b8260035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e33306040518363ffffffff1660e01b815260040161032a929190610fad565b602060405180830381865afa158015610345573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103699190610fe8565b10156103aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a19061105d565b60405180910390fd5b60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330866040518463ffffffff1660e01b81526004016104089392919061107b565b6020604051808303815f875af1158015610424573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061044891906110da565b503373ffffffffffffffffffffffffffffffffffffffff166108fc8290811502906040515f60405180830381858888f1935050505015801561048c573d5f803e3d5ffd5b503373ffffffffffffffffffffffffffffffffffffffff167fbc6a70357c1f438297a419fdda7ea10b11e5e821fa940afc814d2e1fa9c755d7848360035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b81526004016105219190610ea8565b602060405180830381865afa15801561053c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105609190610fe8565b60405161056f93929190611105565b60405180910390a26001915050919050565b60025481565b5f806105b86002546105aa670de0b6b3a764000086610d6d90919063ffffffff16565b610d8290919063ffffffff16565b9050803410156105fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f490611184565b60405180910390fd5b5f60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016106589190610ea8565b602060405180830381865afa158015610673573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106979190610fe8565b9050838110156106dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d3906111ec565b60405180910390fd5b60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33866040518363ffffffff1660e01b815260040161073892919061120a565b6020604051808303815f875af1158015610754573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061077891906110da565b503373ffffffffffffffffffffffffffffffffffffffff167f047d414ddce29eba94711e9709b1446c3bb9339c2472cf6ff20610f80b186912858460035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b815260040161080d9190610ea8565b602060405180830381865afa158015610828573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061084c9190610fe8565b60405161085b93929190611105565b60405180910390a25f6108778334610d9790919063ffffffff16565b90505f8111156108c6573373ffffffffffffffffffffffffffffffffffffffff166108fc8290811502906040515f60405180830381858888f193505050501580156108c4573d5f803e3d5ffd5b505b60019350505050919050565b683635c9adc5dea0000081565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461096e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109659061127b565b60405180910390fd5b683635c9adc5dea000008210156109ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109b190611309565b60405180910390fd5b816002819055507fe65c987b2e4668e09ba867026921588005b2b2063607a1e7e7d91683c8f91b7b826040516109f09190610e50565b60405180910390a160019050919050565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ab1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aa89061127b565b60405180910390fd5b5f60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610b0c9190610ea8565b602060405180830381865afa158015610b27573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b4b9190610fe8565b905060035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401610bc892919061120a565b6020604051808303815f875af1158015610be4573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c0891906110da565b5050565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c99576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c909061127b565b60405180910390fd5b47811115610cdc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cd390611371565b60405180910390fd5b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc8290811502906040515f60405180830381858888f19350505050158015610d3e573d5f803e3d5ffd5b5050565b60015481565b60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f8183610d7a91906113bc565b905092915050565b5f8183610d8f919061142a565b905092915050565b5f8183610da4919061145a565b905092915050565b5f80fd5b5f819050919050565b610dc281610db0565b8114610dcc575f80fd5b50565b5f81359050610ddd81610db9565b92915050565b5f60208284031215610df857610df7610dac565b5b5f610e0584828501610dcf565b91505092915050565b5f8115159050919050565b610e2281610e0e565b82525050565b5f602082019050610e3b5f830184610e19565b92915050565b610e4a81610db0565b82525050565b5f602082019050610e635f830184610e41565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610e9282610e69565b9050919050565b610ea281610e88565b82525050565b5f602082019050610ebb5f830184610e99565b92915050565b5f819050919050565b5f610ee4610edf610eda84610e69565b610ec1565b610e69565b9050919050565b5f610ef582610eca565b9050919050565b5f610f0682610eeb565b9050919050565b610f1681610efc565b82525050565b5f602082019050610f2f5f830184610f0d565b92915050565b5f82825260208201905092915050565b7f496e73756666696369656e742045544820696e20636f6e7472616374000000005f82015250565b5f610f79601c83610f35565b9150610f8482610f45565b602082019050919050565b5f6020820190508181035f830152610fa681610f6d565b9050919050565b5f604082019050610fc05f830185610e99565b610fcd6020830184610e99565b9392505050565b5f81519050610fe281610db9565b92915050565b5f60208284031215610ffd57610ffc610dac565b5b5f61100a84828501610fd4565b91505092915050565b7f546f6b656e20616c6c6f77616e636520746f6f206c6f770000000000000000005f82015250565b5f611047601783610f35565b915061105282611013565b602082019050919050565b5f6020820190508181035f8301526110748161103b565b9050919050565b5f60608201905061108e5f830186610e99565b61109b6020830185610e99565b6110a86040830184610e41565b949350505050565b6110b981610e0e565b81146110c3575f80fd5b50565b5f815190506110d4816110b0565b92915050565b5f602082840312156110ef576110ee610dac565b5b5f6110fc848285016110c6565b91505092915050565b5f6060820190506111185f830186610e41565b6111256020830185610e41565b6111326040830184610e41565b949350505050565b7f496e73756666696369656e74204554482073656e7400000000000000000000005f82015250565b5f61116e601583610f35565b91506111798261113a565b602082019050919050565b5f6020820190508181035f83015261119b81611162565b9050919050565b7f4e6f7420656e6f75676820746f6b656e7320696e20636f6e74726163740000005f82015250565b5f6111d6601d83610f35565b91506111e1826111a2565b602082019050919050565b5f6020820190508181035f830152611203816111ca565b9050919050565b5f60408201905061121d5f830185610e99565b61122a6020830184610e41565b9392505050565b7f43616c6c6572206973206e6f7420746865206f776e65720000000000000000005f82015250565b5f611265601783610f35565b915061127082611231565b602082019050919050565b5f6020820190508181035f83015261129281611259565b9050919050565b7f4e65772072617465206d7573742062652067726561746572207468616e206f725f8201527f20657175616c20746f2049434f20726174650000000000000000000000000000602082015250565b5f6112f3603283610f35565b91506112fe82611299565b604082019050919050565b5f6020820190508181035f830152611320816112e7565b9050919050565b7f496e73756666696369656e742062616c616e63650000000000000000000000005f82015250565b5f61135b601483610f35565b915061136682611327565b602082019050919050565b5f6020820190508181035f8301526113888161134f565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6113c682610db0565b91506113d183610db0565b92508282026113df81610db0565b915082820484148315176113f6576113f561138f565b5b5092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f61143482610db0565b915061143f83610db0565b92508261144f5761144e6113fd565b5b828204905092915050565b5f61146482610db0565b915061146f83610db0565b92508282039050818111156114875761148661138f565b5b9291505056fea2646970667358221220cdc58916ed20762a7de730559d2a581366728a21ec97b616d0e0898f939e500564736f6c634300081a0033a2646970667358221220a12918b78caf4cb2a8be29d4d95862b0f08c0cade58ee4dc77ade854c7c261bf64736f6c634300081a0033
decoded input	{}
decoded output	 - 
logs	[]
raw logs	[]

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidAPIResponse = errors.New("Unknown API error")

ErrInvalidAPIResponse is returned when the API return success: false

View Source
var ErrInvalidCode = errors.New("Invalid currency code")

ErrInvalidCode is returned when the currency code is invalid

View Source
var ErrInvalidDate = errors.New("Oldest possible date is 1999-01-04")

ErrInvalidDate is returned when the date is too old

View Source
var ErrInvalidDateFormat = errors.New("Date format must be YYYY-MM-DD")

ErrInvalidDateFormat is returned when the date isn't formatted as YYYY-MM-DD

View Source
var ErrInvalidTimeFrame = errors.New("From date must be older than To date")

ErrInvalidTimeFrame is returned when the to date is older than to date. For example flipped the arguments

View Source
var ErrTimeframeExceeded = errors.New("Maximum allowed timeframe is 365 days")

ErrTimeframeExceeded is returned when the time between start_date and end_date is bigger than 365 days

Functions

func ValidateCode

func ValidateCode(code string) error

ValidateCode validates a single symbol code

func ValidateDate

func ValidateDate(date string) error

ValidateDate validates date string according to YYYY-MM-DD format and if it's

func ValidateSymbols

func ValidateSymbols(symbols []string) error

ValidateSymbols validates all symbols' codes in an array

func ValidateTimeFrame

func ValidateTimeFrame(TimeFrame [2]string) error

ValidateTimeFrame checks if the from and to date are not more than 365 days apart and they're not mixed

Types

type Exchange

type Exchange struct {
	Base         string
	CacheEnabled bool
	// contains filtered or unexported fields
}

Exchange is returned by New() and allows access to the methods

func New

func New(base string) *Exchange

New creates a new instance of Exchange

func (*Exchange) ConvertAt

func (exchange *Exchange) ConvertAt(date string, target string, amount int) (*big.Float, error)

ConvertAt converts the amount from the exchange.Base currency to the target currency at a selected historical date

func (*Exchange) ConvertTo

func (exchange *Exchange) ConvertTo(target string, amount int) (*big.Float, error)

ConvertTo converts the amount from the exchange.Base currency to the target currency

func (*Exchange) CryptoCodes

func (exchange *Exchange) CryptoCodes() ([]string, error)

CryptoCodes returns and array of supported cryptocurrency codes

func (*Exchange) CryptoData

func (exchange *Exchange) CryptoData() (map[string]map[string]string, error)

CryptoData returns a map of supported cryptocurrencies data (name and symbol)

func (*Exchange) FluctuationAll

func (exchange *Exchange) FluctuationAll(start string, end string) (map[string]map[string]*big.Float, error)

FluctuationAll returns the fluctuation for all supported symbols

func (*Exchange) FluctuationMultiple

func (exchange *Exchange) FluctuationMultiple(start string, end string, symbols []string) (map[string]map[string]*big.Float, error)

FluctuationMultiple returns the fluctuation for multiple symbols

func (*Exchange) FluctuationSingle

func (exchange *Exchange) FluctuationSingle(start string, end string, symbol string) (map[string]*big.Float, error)

FluctuationSingle returns the fluctuation for a single symbol

func (*Exchange) ForexCodes

func (exchange *Exchange) ForexCodes() ([]string, error)

ForexCodes returns and array of supported forex/fiat currency codes

func (*Exchange) ForexData

func (exchange *Exchange) ForexData() (map[string]map[string]string, error)

ForexData returns a map of supported forex/fiat currencies data (code & description)

func (*Exchange) HistoricalRatesAll

func (exchange *Exchange) HistoricalRatesAll(date string) (map[string]*big.Float, error)

HistoricalRatesAll returns the historical exchange rates for all supported currencies

func (*Exchange) HistoricalRatesMultiple

func (exchange *Exchange) HistoricalRatesMultiple(date string, symbols []string) (map[string]*big.Float, error)

HistoricalRatesMultiple returns the historical exchange rates for multiple currencies

func (*Exchange) HistoricalRatesSingle

func (exchange *Exchange) HistoricalRatesSingle(date string, symbol string) (*big.Float, error)

HistoricalRatesSingle returns the historical exchange rates for a single currency

func (*Exchange) LatestRatesAll

func (exchange *Exchange) LatestRatesAll() (map[string]*big.Float, error)

LatestRatesAll returns the latest exchange rates for all supportedcurrencies

func (*Exchange) LatestRatesMultiple

func (exchange *Exchange) LatestRatesMultiple(symbols []string) (map[string]*big.Float, error)

LatestRatesMultiple returns the latest exchange rates for multiple currencies

func (*Exchange) LatestRatesSingle

func (exchange *Exchange) LatestRatesSingle(symbol string) (*big.Float, error)

LatestRatesSingle returns the latest exchange rates for a single currencies

func (*Exchange) SetBase

func (exchange *Exchange) SetBase(base string) error

SetBase sets a new base currency for the exchange rates

func (*Exchange) SetCache

func (exchange *Exchange) SetCache(cache bool)

SetCache enables and disable caching (caching last till midnight when the exchange rates are updated)

func (*Exchange) TimeseriesAll

func (exchange *Exchange) TimeseriesAll(start string, end string) (map[string]map[string]*big.Float, error)

TimeseriesAll returns the timeseries for all supported symbols

func (*Exchange) TimeseriesMultiple

func (exchange *Exchange) TimeseriesMultiple(start string, end string, symbols []string) (map[string]map[string]*big.Float, error)

TimeseriesMultiple returns the timeseries for multiple symbols

func (*Exchange) TimeseriesSingle

func (exchange *Exchange) TimeseriesSingle(start string, end string, symbol string) (map[string]map[string]*big.Float, error)

TimeseriesSingle returns the timeseries for a single symbol<

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL